LibLine: Add bindings for Alt-u, Alt-l, Alt-c
This commit is contained in:
parent
5d343e1c29
commit
90efba95c1
Notes:
sideshowbarker
2024-07-19 04:12:54 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/90efba95c16 Pull-request: https://github.com/SerenityOS/serenity/pull/3027
1 changed files with 21 additions and 1 deletions
|
@ -571,7 +571,7 @@ void Editor::handle_read_event()
|
|||
do_cursor_left(Word);
|
||||
m_state = InputState::Free;
|
||||
continue;
|
||||
case 'd': // ^[d: alt-d
|
||||
case 'd': // ^[d: alt-d: forward delete word
|
||||
{
|
||||
bool has_seen_nonspace = false;
|
||||
while (m_cursor < m_buffer.size()) {
|
||||
|
@ -590,6 +590,26 @@ void Editor::handle_read_event()
|
|||
do_cursor_right(Word);
|
||||
m_state = InputState::Free;
|
||||
continue;
|
||||
case 'c': // ^[c: alt-c: capitalize word
|
||||
case 'l': // ^[l: alt-l: lowercase word
|
||||
case 'u': // ^[u: alt-u: uppercase word
|
||||
{
|
||||
while (m_cursor < m_buffer.size() && isspace(m_buffer[m_cursor]))
|
||||
++m_cursor;
|
||||
size_t start = m_cursor;
|
||||
while (m_cursor < m_buffer.size() && !isspace(m_buffer[m_cursor])) {
|
||||
if (code_point == 'u' || (code_point == 'c' && m_cursor == start)) {
|
||||
m_buffer[m_cursor] = toupper(m_buffer[m_cursor]);
|
||||
} else {
|
||||
ASSERT(code_point == 'l' || (code_point == 'c' && m_cursor > start));
|
||||
m_buffer[m_cursor] = tolower(m_buffer[m_cursor]);
|
||||
}
|
||||
++m_cursor;
|
||||
m_refresh_needed = true;
|
||||
}
|
||||
m_state = InputState::Free;
|
||||
continue;
|
||||
}
|
||||
default:
|
||||
m_state = InputState::Free;
|
||||
continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue