Ver código fonte

LibLine: Treat ^D as EOF only when the buffer is empty

As opposed to when the cursor is at the start of the buffer.
Fixes #3421.
AnotherTest 4 anos atrás
pai
commit
39d14c22d1
1 arquivos alterados com 2 adições e 1 exclusões
  1. 2 1
      Libraries/LibLine/Editor.cpp

+ 2 - 1
Libraries/LibLine/Editor.cpp

@@ -738,7 +738,8 @@ void Editor::handle_read_event()
 
         // Normally ^D. `stty eof \^n` can change it to ^N (or something else), but Serenity doesn't have `stty` yet.
         // Process this here since the keybinds might override its behaviour.
-        if (code_point == m_termios.c_cc[VEOF] && m_cursor == 0) {
+        // This only applies when the buffer is empty. at any other time, the behaviour should be configurable.
+        if (code_point == m_termios.c_cc[VEOF] && m_buffer.size() == 0) {
             finish_edit();
             continue;
         }