mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
LibEdit: Make Ctrl-d on an empty line mean EOD again
This commit is contained in:
parent
8f3151eea8
commit
ad8e784938
1 changed files with 11 additions and 12 deletions
|
@ -757,11 +757,22 @@ void Editor::handle_read_event()
|
||||||
m_refresh_needed = true;
|
m_refresh_needed = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Normally ^D. `stty eof \^n` can change it to ^N (or something else), but Serenity doesn't have `stty` yet.
|
||||||
|
// Handle it before ctrl shortcuts below and only continue if the buffer is empty, so that the editing shortcuts can take effect else.
|
||||||
|
if (codepoint == m_termios.c_cc[VEOF] && m_buffer.is_empty()) {
|
||||||
|
printf("<EOF>\n");
|
||||||
|
if (!m_always_refresh) {
|
||||||
|
m_input_error = Error::Eof;
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// ^A
|
// ^A
|
||||||
if (codepoint == ctrl('A')) {
|
if (codepoint == ctrl('A')) {
|
||||||
m_cursor = 0;
|
m_cursor = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// ^B
|
||||||
if (codepoint == ctrl('B')) {
|
if (codepoint == ctrl('B')) {
|
||||||
do_cursor_left(Character);
|
do_cursor_left(Character);
|
||||||
continue;
|
continue;
|
||||||
|
@ -910,18 +921,6 @@ void Editor::handle_read_event()
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Normally ^D
|
|
||||||
if (codepoint == m_termios.c_cc[VEOF]) {
|
|
||||||
if (m_buffer.is_empty()) {
|
|
||||||
printf("<EOF>\n");
|
|
||||||
if (!m_always_refresh) {
|
|
||||||
m_input_error = Error::Eof;
|
|
||||||
finish();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (codepoint == '\n') {
|
if (codepoint == '\n') {
|
||||||
finish();
|
finish();
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue