summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-04-20 22:00:59 +0430
committerAndreas Kling <kling@serenityos.org>2020-04-20 20:23:26 +0200
commit54d400c685c59a327b66ce9c74796106ab3704de (patch)
tree80546c0e9df9dddaf527e3f2e8d21d40a4ad5127
parent50218f7edce70788a99691fda4b185861530a804 (diff)
downloadserenity-54d400c685c59a327b66ce9c74796106ab3704de.zip
LibVT: Handle ctrl+arrow keys
Prior to this commit, we would treat them the same.
-rw-r--r--Libraries/LibVT/TerminalWidget.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/Libraries/LibVT/TerminalWidget.cpp b/Libraries/LibVT/TerminalWidget.cpp
index 45b60a710f..1b47bd923a 100644
--- a/Libraries/LibVT/TerminalWidget.cpp
+++ b/Libraries/LibVT/TerminalWidget.cpp
@@ -195,19 +195,20 @@ void TerminalWidget::keydown_event(GUI::KeyEvent& event)
m_cursor_blink_timer->stop();
m_cursor_blink_state = true;
m_cursor_blink_timer->start();
+ auto ctrl_held = !!(event.modifiers() & Mod_Ctrl);
switch (event.key()) {
case KeyCode::Key_Up:
- write(m_ptm_fd, "\033[A", 3);
+ write(m_ptm_fd, ctrl_held ? "\033[OA" : "\033[A", 3 + ctrl_held);
return;
case KeyCode::Key_Down:
- write(m_ptm_fd, "\033[B", 3);
+ write(m_ptm_fd, ctrl_held ? "\033[OB" : "\033[B", 3 + ctrl_held);
return;
case KeyCode::Key_Right:
- write(m_ptm_fd, "\033[C", 3);
+ write(m_ptm_fd, ctrl_held ? "\033[OC" : "\033[C", 3 + ctrl_held);
return;
case KeyCode::Key_Left:
- write(m_ptm_fd, "\033[D", 3);
+ write(m_ptm_fd, ctrl_held ? "\033[OD" : "\033[D", 3 + ctrl_held);
return;
case KeyCode::Key_Insert:
write(m_ptm_fd, "\033[2~", 4);