mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03: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
Notes:
sideshowbarker
2024-07-19 05:05:29 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/f27e5ac68d2 Pull-request: https://github.com/SerenityOS/serenity/pull/2715 Reviewed-by: https://github.com/alimpfard
@ -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…
Reference in New Issue
Block a user