File src/hstr.c changed (mode: 100644) (index eb5183c..9bcaeab) |
... |
... |
static const char *LABEL_HELP= |
155 |
155 |
"Type to filter, UP/DOWN move, DEL remove, TAB select, C-f add favorite, C-g cancel"; |
"Type to filter, UP/DOWN move, DEL remove, TAB select, C-f add favorite, C-g cancel"; |
156 |
156 |
|
|
157 |
157 |
// TODO makes hstr.c non-reentrant |
// TODO makes hstr.c non-reentrant |
158 |
|
static char screenLine[CMDLINE_LNG]; |
|
|
158 |
|
//static char screenLine[CMDLINE_LNG]; |
159 |
159 |
|
|
160 |
160 |
typedef struct { |
typedef struct { |
161 |
161 |
HistoryItems *history; |
HistoryItems *history; |
|
... |
... |
int print_prompt(Hstr *hstr) |
255 |
255 |
|
|
256 |
256 |
void print_help_label() |
void print_help_label() |
257 |
257 |
{ |
{ |
|
258 |
|
char screenLine[CMDLINE_LNG]; |
258 |
259 |
snprintf(screenLine, getmaxx(stdscr), "%s", LABEL_HELP); |
snprintf(screenLine, getmaxx(stdscr), "%s", LABEL_HELP); |
259 |
260 |
mvprintw(Y_OFFSET_HELP, 0, "%s", screenLine); clrtoeol(); |
mvprintw(Y_OFFSET_HELP, 0, "%s", screenLine); clrtoeol(); |
260 |
261 |
refresh(); |
refresh(); |
|
... |
... |
void print_help_label() |
262 |
263 |
|
|
263 |
264 |
void print_cmd_deleted_label(char *cmd, int occurences, Hstr *hstr) |
void print_cmd_deleted_label(char *cmd, int occurences, Hstr *hstr) |
264 |
265 |
{ |
{ |
|
266 |
|
char screenLine[CMDLINE_LNG]; |
265 |
267 |
snprintf(screenLine, getmaxx(stdscr), "History item '%s' deleted (%d occurrence%s)", cmd, occurences, (occurences==1?"":"s")); |
snprintf(screenLine, getmaxx(stdscr), "History item '%s' deleted (%d occurrence%s)", cmd, occurences, (occurences==1?"":"s")); |
266 |
268 |
if(hstr->hicolor) { |
if(hstr->hicolor) { |
267 |
269 |
color_attr_on(COLOR_PAIR(HH_COLOR_DELETE)); |
color_attr_on(COLOR_PAIR(HH_COLOR_DELETE)); |
|
... |
... |
void print_cmd_deleted_label(char *cmd, int occurences, Hstr *hstr) |
278 |
280 |
|
|
279 |
281 |
void print_cmd_added_favorite_label(char *cmd, Hstr *hstr) |
void print_cmd_added_favorite_label(char *cmd, Hstr *hstr) |
280 |
282 |
{ |
{ |
|
283 |
|
char screenLine[CMDLINE_LNG]; |
281 |
284 |
snprintf(screenLine, getmaxx(stdscr), "Command '%s' added to favorites (C-/ to show favorites)", cmd); |
snprintf(screenLine, getmaxx(stdscr), "Command '%s' added to favorites (C-/ to show favorites)", cmd); |
282 |
285 |
if(hstr->hicolor) { |
if(hstr->hicolor) { |
283 |
286 |
color_attr_on(COLOR_PAIR(HH_COLOR_INFO)); |
color_attr_on(COLOR_PAIR(HH_COLOR_INFO)); |
|
... |
... |
void print_history_label(Hstr *hstr) |
296 |
299 |
{ |
{ |
297 |
300 |
int width=getmaxx(stdscr); |
int width=getmaxx(stdscr); |
298 |
301 |
|
|
|
302 |
|
char screenLine[CMDLINE_LNG]; |
299 |
303 |
snprintf(screenLine, width, "- HISTORY - view:%s (C-/) - match:%s (C-e) - case:%s (C-t) - %d/%d ", |
snprintf(screenLine, width, "- HISTORY - view:%s (C-/) - match:%s (C-e) - case:%s (C-t) - %d/%d ", |
300 |
304 |
HH_VIEW_LABELS[hstr->historyView], |
HH_VIEW_LABELS[hstr->historyView], |
301 |
305 |
HH_MATCH_LABELS[hstr->historyMatch], |
HH_MATCH_LABELS[hstr->historyMatch], |
|
... |
... |
unsigned hstr_make_selection(char *prefix, HistoryItems *history, int maxSelecti |
446 |
450 |
|
|
447 |
451 |
void print_selection_row(char *text, int y, int width, char *pattern) |
void print_selection_row(char *text, int y, int width, char *pattern) |
448 |
452 |
{ |
{ |
|
453 |
|
char screenLine[CMDLINE_LNG]; |
449 |
454 |
snprintf(screenLine, width, " %s", text); |
snprintf(screenLine, width, " %s", text); |
450 |
455 |
mvprintw(y, 0, "%s", screenLine); clrtoeol(); |
mvprintw(y, 0, "%s", screenLine); clrtoeol(); |
451 |
456 |
|
|
|
... |
... |
void hstr_print_highlighted_selection_row(char *text, int y, int width, Hstr *hs |
484 |
489 |
} else { |
} else { |
485 |
490 |
color_attr_on(A_REVERSE); |
color_attr_on(A_REVERSE); |
486 |
491 |
} |
} |
|
492 |
|
char screenLine[CMDLINE_LNG]; |
487 |
493 |
snprintf(screenLine, getmaxx(stdscr), |
snprintf(screenLine, getmaxx(stdscr), |
488 |
494 |
"%s%s" SPACE_PADDING SPACE_PADDING SPACE_PADDING, |
"%s%s" SPACE_PADDING SPACE_PADDING SPACE_PADDING, |
489 |
495 |
(terminal_has_colors()?" ":">"), text); |
(terminal_has_colors()?" ":">"), text); |