File src/hstr.c changed (mode: 100644) (index d08a4dc..51f2505) |
... |
... |
void print_history_label(Hstr *hstr) |
336 |
336 |
int width=getmaxx(stdscr); |
int width=getmaxx(stdscr); |
337 |
337 |
|
|
338 |
338 |
char screenLine[CMDLINE_LNG]; |
char screenLine[CMDLINE_LNG]; |
339 |
|
snprintf(screenLine, width, "- HISTORY - view:%s (C-/) - match:%s (C-e) - case:%s (C-t) - %d/%d ", |
|
|
339 |
|
snprintf(screenLine, width, "- HISTORY - view:%s (C-/) - match:%s (C-e) - case:%s (C-t) - %d/%d/%d ", |
340 |
340 |
HH_VIEW_LABELS[hstr->historyView], |
HH_VIEW_LABELS[hstr->historyView], |
341 |
341 |
HH_MATCH_LABELS[hstr->historyMatch], |
HH_MATCH_LABELS[hstr->historyMatch], |
342 |
342 |
HH_CASE_LABELS[hstr->caseSensitive], |
HH_CASE_LABELS[hstr->caseSensitive], |
343 |
343 |
hstr->history->count, |
hstr->history->count, |
344 |
|
hstr->history->rawCount); |
|
|
344 |
|
hstr->history->rawCount, |
|
345 |
|
hstr->favorites->count); |
345 |
346 |
width -= strlen(screenLine); |
width -= strlen(screenLine); |
346 |
347 |
unsigned i; |
unsigned i; |
347 |
348 |
for (i=0; i < width; i++) { |
for (i=0; i < width; i++) { |
|
... |
... |
void loop_to_select(Hstr *hstr) |
758 |
759 |
// TODO make this a function |
// TODO make this a function |
759 |
760 |
result=hstr_print_selection(maxHistoryItems, pattern, hstr); |
result=hstr_print_selection(maxHistoryItems, pattern, hstr); |
760 |
761 |
print_history_label(hstr); |
print_history_label(hstr); |
761 |
|
selectionCursorPosition=0; |
|
|
762 |
|
selectionCursorPosition=SELECTION_CURSOR_IN_PROMPT; |
762 |
763 |
if(strlen(pattern)<(width-basex-1)) { |
if(strlen(pattern)<(width-basex-1)) { |
763 |
764 |
print_prefix(pattern, y, basex); |
print_prefix(pattern, y, basex); |
764 |
765 |
cursorX=getcurx(stdscr); |
cursorX=getcurx(stdscr); |
|
... |
... |
void loop_to_select(Hstr *hstr) |
770 |
771 |
hstr->regexp.caseSensitive=hstr->caseSensitive; |
hstr->regexp.caseSensitive=hstr->caseSensitive; |
771 |
772 |
result=hstr_print_selection(maxHistoryItems, pattern, hstr); |
result=hstr_print_selection(maxHistoryItems, pattern, hstr); |
772 |
773 |
print_history_label(hstr); |
print_history_label(hstr); |
773 |
|
selectionCursorPosition=0; |
|
|
774 |
|
selectionCursorPosition=SELECTION_CURSOR_IN_PROMPT; |
774 |
775 |
if(strlen(pattern)<(width-basex-1)) { |
if(strlen(pattern)<(width-basex-1)) { |
775 |
776 |
print_prefix(pattern, y, basex); |
print_prefix(pattern, y, basex); |
776 |
777 |
cursorX=getcurx(stdscr); |
cursorX=getcurx(stdscr); |
|
... |
... |
void loop_to_select(Hstr *hstr) |
800 |
801 |
printDefaultLabel=TRUE; |
printDefaultLabel=TRUE; |
801 |
802 |
} |
} |
802 |
803 |
result=hstr_print_selection(maxHistoryItems, pattern, hstr); |
result=hstr_print_selection(maxHistoryItems, pattern, hstr); |
803 |
|
selectionCursorPosition=0; |
|
|
804 |
|
selectionCursorPosition=SELECTION_CURSOR_IN_PROMPT; |
804 |
805 |
} |
} |
805 |
806 |
break; |
break; |
806 |
807 |
case KEY_RESIZE: |
case KEY_RESIZE: |
807 |
808 |
print_history_label(hstr); |
print_history_label(hstr); |
808 |
809 |
result=hstr_print_selection(maxHistoryItems, pattern, hstr); |
result=hstr_print_selection(maxHistoryItems, pattern, hstr); |
809 |
810 |
print_history_label(hstr); |
print_history_label(hstr); |
810 |
|
selectionCursorPosition=0; |
|
|
811 |
|
selectionCursorPosition=SELECTION_CURSOR_IN_PROMPT; |
811 |
812 |
move(y, basex+strlen(pattern)); |
move(y, basex+strlen(pattern)); |
812 |
813 |
break; |
break; |
813 |
814 |
case K_CTRL_U: |
case K_CTRL_U: |
|
... |
... |
void loop_to_select(Hstr *hstr) |
819 |
820 |
toggle_case(pattern, lowercase); |
toggle_case(pattern, lowercase); |
820 |
821 |
lowercase=!lowercase; |
lowercase=!lowercase; |
821 |
822 |
print_prefix(pattern, y, basex); |
print_prefix(pattern, y, basex); |
822 |
|
selectionCursorPosition=0; |
|
|
823 |
|
selectionCursorPosition=SELECTION_CURSOR_IN_PROMPT; |
823 |
824 |
break; |
break; |
824 |
825 |
case K_CTRL_H: |
case K_CTRL_H: |
825 |
826 |
case K_BACKSPACE: |
case K_BACKSPACE: |
|
... |
... |
void loop_to_select(Hstr *hstr) |
879 |
880 |
favorites_choose(hstr->favorites,result); |
favorites_choose(hstr->favorites,result); |
880 |
881 |
} |
} |
881 |
882 |
} else { |
} else { |
882 |
|
executeResult=FALSE; |
|
883 |
|
break; |
|
|
883 |
|
result=(pattern==NULL?"":pattern); |
884 |
884 |
} |
} |
885 |
885 |
done=TRUE; |
done=TRUE; |
886 |
886 |
break; |
break; |