mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Shell: Exit the shell on (interactive) EOF with empty buffer
In other words, if the user presses EOF (normally Ctrl+D), we now print out "<EOF>" and exit the shell without error. Fixes #701.
This commit is contained in:
parent
390b219cd1
commit
845094f9e4
Notes:
sideshowbarker
2024-07-19 11:28:53 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/845094f9e45
1 changed files with 7 additions and 0 deletions
|
@ -302,6 +302,13 @@ String LineEditor::get_line(const String& prompt)
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if (ch == g.termios.c_cc[VEOF]) { // Normally ^D
|
||||
if (m_buffer.is_empty()) {
|
||||
printf("<EOF>\n");
|
||||
exit(0);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (ch == 0x05) { // ^E
|
||||
if (m_cursor < m_buffer.size()) {
|
||||
printf("\033[%dC", m_buffer.size() - m_cursor);
|
||||
|
|
Loading…
Reference in a new issue