File src/hstr.c changed (mode: 100644) (index 498176f..b394c26) |
... |
... |
void print_help_label() |
431 |
431 |
refresh(); |
refresh(); |
432 |
432 |
} |
} |
433 |
433 |
|
|
|
434 |
|
void print_confirm_delete(const char *cmd, Hstr *hstr) |
|
435 |
|
{ |
|
436 |
|
char screenLine[CMDLINE_LNG]; |
|
437 |
|
snprintf(screenLine, getmaxx(stdscr), "Do you want to delete all occurrences of '%s'? y/n", cmd); |
|
438 |
|
// TODO make this function |
|
439 |
|
if(hstr->theme & HH_THEME_COLOR) { |
|
440 |
|
color_attr_on(COLOR_PAIR(HH_COLOR_DELETE)); |
|
441 |
|
color_attr_on(A_BOLD); |
|
442 |
|
} |
|
443 |
|
mvprintw(hstr->promptYHelp, 0, "%s", screenLine); |
|
444 |
|
if(hstr->theme & HH_THEME_COLOR) { |
|
445 |
|
color_attr_off(A_BOLD); |
|
446 |
|
color_attr_on(COLOR_PAIR(1)); |
|
447 |
|
} |
|
448 |
|
clrtoeol(); |
|
449 |
|
refresh(); |
|
450 |
|
} |
|
451 |
|
|
434 |
452 |
void print_cmd_deleted_label(const char *cmd, int occurences, Hstr *hstr) |
void print_cmd_deleted_label(const char *cmd, int occurences, Hstr *hstr) |
435 |
453 |
{ |
{ |
436 |
454 |
char screenLine[CMDLINE_LNG]; |
char screenLine[CMDLINE_LNG]; |
|
... |
... |
void loop_to_select(Hstr *hstr) |
963 |
981 |
bool done=FALSE, skip=TRUE, executeResult=FALSE, lowercase=TRUE; |
bool done=FALSE, skip=TRUE, executeResult=FALSE, lowercase=TRUE; |
964 |
982 |
bool printDefaultLabel=TRUE, fixCommand=FALSE, editCommand=FALSE; |
bool printDefaultLabel=TRUE, fixCommand=FALSE, editCommand=FALSE; |
965 |
983 |
int basex=print_prompt(); |
int basex=print_prompt(); |
966 |
|
int x=basex, c, cursorX=0, cursorY=0, maxHistoryItems, deletedOccurences; |
|
|
984 |
|
int x=basex, c, cc, cursorX=0, cursorY=0, maxHistoryItems, deletedOccurences; |
967 |
985 |
int width=getmaxx(stdscr); |
int width=getmaxx(stdscr); |
968 |
986 |
int selectionCursorPosition=SELECTION_CURSOR_IN_PROMPT; |
int selectionCursorPosition=SELECTION_CURSOR_IN_PROMPT; |
969 |
987 |
int previousSelectionCursorPosition=SELECTION_CURSOR_IN_PROMPT; |
int previousSelectionCursorPosition=SELECTION_CURSOR_IN_PROMPT; |
|
... |
... |
void loop_to_select(Hstr *hstr) |
1010 |
1028 |
delete=getResultFromSelection(selectionCursorPosition, hstr, result); |
delete=getResultFromSelection(selectionCursorPosition, hstr, result); |
1011 |
1029 |
msg=malloc(strlen(delete)+1); |
msg=malloc(strlen(delete)+1); |
1012 |
1030 |
strcpy(msg,delete); |
strcpy(msg,delete); |
1013 |
|
deletedOccurences=remove_from_history_model(msg, hstr); |
|
1014 |
|
result=hstr_print_selection(maxHistoryItems, pattern, hstr); |
|
1015 |
|
print_cmd_deleted_label(msg, deletedOccurences, hstr); |
|
|
1031 |
|
|
|
1032 |
|
print_confirm_delete(msg, hstr); |
|
1033 |
|
cc = wgetch(stdscr); |
|
1034 |
|
if(cc == 'y') { |
|
1035 |
|
deletedOccurences=remove_from_history_model(msg, hstr); |
|
1036 |
|
result=hstr_print_selection(maxHistoryItems, pattern, hstr); |
|
1037 |
|
print_cmd_deleted_label(msg, deletedOccurences, hstr); |
|
1038 |
|
} else { |
|
1039 |
|
print_help_label(); |
|
1040 |
|
} |
1016 |
1041 |
free(msg); |
free(msg); |
1017 |
1042 |
move(hstr->promptY, basex+strlen(pattern)); |
move(hstr->promptY, basex+strlen(pattern)); |
1018 |
1043 |
printDefaultLabel=TRUE; |
printDefaultLabel=TRUE; |