mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
Shell: Handle SIGWINCH to get a nice behavior when resizing.
When resizing the terminal, we now clear the entire current line and reset the shell's LineEditor input state. This makes it look and feel kinda the same as xterm. Fixes #286.
This commit is contained in:
parent
2c81477f16
commit
fc4022d173
Notes:
sideshowbarker
2024-07-19 13:21:49 +09:00
Author: https://github.com/awesomekling
Commit: fc4022d173
3 changed files with 18 additions and 27 deletions
|
@ -50,10 +50,16 @@ String LineEditor::get_line()
|
|||
if (nread < 0) {
|
||||
if (errno == EINTR) {
|
||||
if (g.was_interrupted) {
|
||||
g.was_interrupted = false;
|
||||
if (!m_buffer.is_empty())
|
||||
printf("^C");
|
||||
}
|
||||
g.was_interrupted = false;
|
||||
if (g.was_resized) {
|
||||
g.was_resized = false;
|
||||
printf("\033[2K\r");
|
||||
m_buffer.clear();
|
||||
return String::empty();
|
||||
}
|
||||
m_buffer.clear();
|
||||
putchar('\n');
|
||||
return String::empty();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue