# HG changeset patch # User mikael # Date 1115274352 0 # Node ID 7b7dd6d69f581dec2dd13cf9444fb9f2b2e0c8d6 # Parent 6354625e8fb2e1c0bd6bd79e8ba86ccd09077031 [/trunk] Changeset 187 by mikael * Change shoortcuts: - PgUP/PgDown ==> move in roster - Up/Down ==> move in history (input line) - C-p/C-n ==> move in chat history buffer diff -r 6354625e8fb2 -r 7b7dd6d69f58 mcabber/src/screen.c --- a/mcabber/src/screen.c Thu May 05 06:17:41 2005 +0000 +++ b/mcabber/src/screen.c Thu May 05 06:25:52 2005 +0000 @@ -966,6 +966,7 @@ // scr_cmdhisto_prev() // Look for previous line beginning w/ the given mask in the inputLine history +// Returns NULL if none found const char *scr_cmdhisto_prev(char *mask, guint len) { GList *hl; @@ -990,6 +991,7 @@ // scr_cmdhisto_next() // Look for next line beginning w/ the given mask in the inputLine history +// Returns NULL if none found const char *scr_cmdhisto_next(char *mask, guint len) { GList *hl; @@ -1001,8 +1003,8 @@ cmdhisto_cur = hl; return (const char*)hl->data; } - if (strncmp(cmdhisto_backup, mask, len)) - return NULL; + // If the "backuped" line matches, we'll use it + if (strncmp(cmdhisto_backup, mask, len)) return NULL; // No match cmdhisto_cur = NULL; return cmdhisto_backup; } @@ -1218,16 +1220,28 @@ inputline_offset = 0; break; case KEY_UP: - scr_RosterUp(); + { + const char *l = scr_cmdhisto_prev(inputLine, + ptr_inputline-inputLine); + if (l) { + strcpy(inputLine, l); + } + } break; case KEY_DOWN: - scr_RosterDown(); + { + const char *l = scr_cmdhisto_next(inputLine, + ptr_inputline-inputLine); + if (l) { + strcpy(inputLine, l); + } + } break; case KEY_PPAGE: - scr_ScrollUp(); + scr_RosterUp(); break; case KEY_NPAGE: - scr_ScrollDown(); + scr_RosterDown(); break; case KEY_HOME: case 1: @@ -1249,22 +1263,10 @@ *ptr_inputline = 0; break; case 16: // Ctrl-p - { - const char *l = scr_cmdhisto_prev(inputLine, - ptr_inputline-inputLine); - if (l) { - strcpy(inputLine, l); - } - } + scr_ScrollUp(); break; case 14: // Ctrl-n - { - const char *l = scr_cmdhisto_next(inputLine, - ptr_inputline-inputLine); - if (l) { - strcpy(inputLine, l); - } - } + scr_ScrollDown(); break; case 27: // ESC currentWindow = NULL;