mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 17:07:35 +00:00
LibLine: Support Ctrl-b/f and Ctrl-d
And make the existing cltr-h handler easier to see.
This commit is contained in:
parent
72f8b3d185
commit
f27e5ac68d
1 changed files with 19 additions and 4 deletions
|
@ -737,10 +737,6 @@ void Editor::handle_read_event()
|
||||||
}
|
}
|
||||||
m_times_tab_pressed = 0; // Safe to say if we get here, the user didn't press TAB
|
m_times_tab_pressed = 0; // Safe to say if we get here, the user didn't press TAB
|
||||||
|
|
||||||
if (codepoint == '\b' || codepoint == m_termios.c_cc[VERASE]) {
|
|
||||||
do_backspace();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (codepoint == m_termios.c_cc[VWERASE]) {
|
if (codepoint == m_termios.c_cc[VWERASE]) {
|
||||||
bool has_seen_nonspace = false;
|
bool has_seen_nonspace = false;
|
||||||
while (m_cursor > 0) {
|
while (m_cursor > 0) {
|
||||||
|
@ -766,11 +762,30 @@ void Editor::handle_read_event()
|
||||||
m_cursor = 0;
|
m_cursor = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (codepoint == ctrl('B')) {
|
||||||
|
do_cursor_left(Character);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// ^D
|
||||||
|
if (codepoint == ctrl('D')) {
|
||||||
|
do_delete();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// ^E
|
// ^E
|
||||||
if (codepoint == ctrl('E')) {
|
if (codepoint == ctrl('E')) {
|
||||||
m_cursor = m_buffer.size();
|
m_cursor = m_buffer.size();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// ^F
|
||||||
|
if (codepoint == ctrl('F')) {
|
||||||
|
do_cursor_right(Character);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// ^H: ctrl('H') == '\b'
|
||||||
|
if (codepoint == '\b' || codepoint == m_termios.c_cc[VERASE]) {
|
||||||
|
do_backspace();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// ^L
|
// ^L
|
||||||
if (codepoint == ctrl('L')) {
|
if (codepoint == ctrl('L')) {
|
||||||
printf("\033[3J\033[H\033[2J"); // Clear screen.
|
printf("\033[3J\033[H\033[2J"); // Clear screen.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue