]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
curses: support keypad scroll keys 634/head
authoryvs <VSYakovetsky@gmail.com>
Fri, 8 May 2026 14:01:54 +0000 (18:01 +0400)
committerDarafei Praliaskouski <me@komzpa.net>
Fri, 8 May 2026 14:01:54 +0000 (18:01 +0400)
Port the keypad setup and scroll-key idea from the mtr085 fork.  Map arrow and page keys onto upstream mtr existing scroll actions instead of bringing over the fork-specific line/page action model.

Ported-from: yvs2014/mtr085@67724401b8549d5ba597671aadced3b0c4cc53b3

Original-author: yvs <VSYakovetsky@gmail.com>

ui/curses.c

index aa9a57c4cb8cbb673dc83bdf52deac9c569bbd19..f0545e8111c642764970cf91a155fb5ea8ed79fb 100644 (file)
@@ -199,8 +199,12 @@ int mtr_curses_keyaction(
         return ActionAS;
 #endif
     case '+':
+    case KEY_NPAGE:
+    case KEY_DOWN:
         return ActionScrollDown;
     case '-':
+    case KEY_PPAGE:
+    case KEY_UP:
         return ActionScrollUp;
     case 's':
         mvprintw(2, 0, "Change Packet Size: %d\n", ctl->cpacketsize);
@@ -1011,6 +1015,7 @@ void mtr_curses_open(
     initscr();
     raw();
     noecho();
+    keypad(stdscr, TRUE);
     start_color();
     if (use_default_colors() == OK)
         bg_col = -1;