From aae195b845bc6ce4bb44fdada68524cb80b11685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20K=C3=B6ster?= Date: Fri, 8 May 2015 16:45:08 +0200 Subject: [PATCH 1/2] added suport for further special keys * pageUp and pageDown will now jump 10 entries up/down * added case for home and end keys to avoid printing of wild chars in search prompt --- src/hstr.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/hstr.c b/src/hstr.c index 6f1e864..9c19d24 100644 --- a/src/hstr.c +++ b/src/hstr.c @@ -49,6 +49,8 @@ #define Y_OFFSET_HISTORY 2 #define Y_OFFSET_ITEMS 3 +#define PG_JUMP_SIZE 10 + #define K_CTRL_A 1 #define K_CTRL_E 5 #define K_CTRL_F 6 @@ -861,6 +863,12 @@ void loop_to_select(Hstr *hstr) } switch (c) { + case KEY_HOME: + // TODO implement in pattern cursor jump to beginning + break; + case KEY_END: + // TODO implement in pattern cursor jump to end + break; case KEY_DC: // DEL if(selectionCursorPosition!=SELECTION_CURSOR_IN_PROMPT) { delete=hstr->selection[selectionCursorPosition]; @@ -988,6 +996,16 @@ void loop_to_select(Hstr *hstr) highlight_selection(selectionCursorPosition, previousSelectionCursorPosition, pattern, hstr); move(y, basex+strlen(pattern)); break; + case KEY_PPAGE: + previousSelectionCursorPosition=selectionCursorPosition; + if(selectionCursorPosition>=PG_JUMP_SIZE) { + selectionCursorPosition=selectionCursorPosition-PG_JUMP_SIZE; + } else { + selectionCursorPosition=0; + } + highlight_selection(selectionCursorPosition, previousSelectionCursorPosition, pattern, hstr); + move(y, basex+strlen(pattern)); + break; case K_CTRL_R: case KEY_DOWN: case K_CTRL_N: @@ -1006,6 +1024,22 @@ void loop_to_select(Hstr *hstr) } move(y, basex+strlen(pattern)); break; + case KEY_NPAGE: + if(selectionCursorPosition==SELECTION_CURSOR_IN_PROMPT) { + selectionCursorPosition=previousSelectionCursorPosition=0; + } else { + previousSelectionCursorPosition=selectionCursorPosition; + if((selectionCursorPosition+PG_JUMP_SIZE)selectionSize) { + selectionCursorPosition = selectionCursorPosition+PG_JUMP_SIZE; + } else { + selectionCursorPosition=hstr->selectionSize-1; + } + } + if(hstr->selectionSize) { + highlight_selection(selectionCursorPosition, previousSelectionCursorPosition, pattern, hstr); + } + move(y, basex+strlen(pattern)); + break; case K_ENTER: case KEY_ENTER: executeResult=TRUE; From fbc8bb81eb11f556444f61f947dd0f4f0ad24544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20K=C3=B6ster?= Date: Fri, 8 May 2015 16:51:29 +0200 Subject: [PATCH 2/2] modified home/end key comment --- src/hstr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hstr.c b/src/hstr.c index 9c19d24..e57f6ff 100644 --- a/src/hstr.c +++ b/src/hstr.c @@ -864,10 +864,10 @@ void loop_to_select(Hstr *hstr) switch (c) { case KEY_HOME: - // TODO implement in pattern cursor jump to beginning + // avoids printing of wild chars in search prompt break; case KEY_END: - // TODO implement in pattern cursor jump to end + // avoids printing of wild chars in search prompt break; case KEY_DC: // DEL if(selectionCursorPosition!=SELECTION_CURSOR_IN_PROMPT) {