mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibLine: Add ctrl-t shortcut for transposing characters
This commit is contained in:
parent
ec5845212d
commit
6105f063cb
Notes:
sideshowbarker
2024-07-19 05:01:04 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/6105f063cb9 Pull-request: https://github.com/SerenityOS/serenity/pull/2735 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/awesomekling
1 changed files with 11 additions and 0 deletions
|
@ -921,6 +921,17 @@ void Editor::handle_read_event()
|
|||
}
|
||||
continue;
|
||||
}
|
||||
// ^T
|
||||
if (codepoint == ctrl('T')) {
|
||||
if (m_cursor > 0 && m_buffer.size() >= 2) {
|
||||
if (m_cursor < m_buffer.size())
|
||||
++m_cursor;
|
||||
swap(m_buffer[m_cursor - 1], m_buffer[m_cursor - 2]);
|
||||
// FIXME: Update anchored styles too.
|
||||
m_refresh_needed = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (codepoint == '\n') {
|
||||
finish();
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue