Merge pull request #150 from nkoester/nkoester-fork/pgUpDownHomeEnd

support for page up/down
This commit is contained in:
dvorka 2015-05-09 14:51:48 +02:00
commit 07ec0dc658

View file

@ -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:
// avoids printing of wild chars in search prompt
break;
case KEY_END:
// avoids printing of wild chars in search prompt
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)<hstr->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;