mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibEdit: Make Ctrl-d on an empty line mean EOD again
This commit is contained in:
parent
8f3151eea8
commit
ad8e784938
Notes:
sideshowbarker
2024-07-19 05:01:58 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/ad8e7849383 Pull-request: https://github.com/SerenityOS/serenity/pull/2734
1 changed files with 11 additions and 12 deletions
|
@ -757,11 +757,22 @@ void Editor::handle_read_event()
|
|||
m_refresh_needed = true;
|
||||
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
|
||||
if (codepoint == ctrl('A')) {
|
||||
m_cursor = 0;
|
||||
continue;
|
||||
}
|
||||
// ^B
|
||||
if (codepoint == ctrl('B')) {
|
||||
do_cursor_left(Character);
|
||||
continue;
|
||||
|
@ -910,18 +921,6 @@ void Editor::handle_read_event()
|
|||
}
|
||||
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') {
|
||||
finish();
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue