Fix favorites delete messages.

This commit is contained in:
Fabian Sandoval Saldias 2019-12-16 19:41:35 +01:00
parent 0c17ce178b
commit 53795974da

View file

@ -554,7 +554,11 @@ void print_help_label(void)
void print_confirm_delete(const char* cmd)
{
char screenLine[CMDLINE_LNG];
snprintf(screenLine, getmaxx(stdscr), "Do you want to delete all occurrences of '%s'? y/n", cmd);
if(hstr->view==HSTR_VIEW_FAVORITES) {
snprintf(screenLine, getmaxx(stdscr), "Do you want to delete favorites item '%s'? y/n", cmd);
} else {
snprintf(screenLine, getmaxx(stdscr), "Do you want to delete all occurrences of '%s'? y/n", cmd);
}
// TODO make this function
if(hstr->theme & HSTR_THEME_COLOR) {
color_attr_on(COLOR_PAIR(HSTR_COLOR_DELETE));
@ -572,7 +576,11 @@ void print_confirm_delete(const char* cmd)
void print_cmd_deleted_label(const char* cmd, int occurences)
{
char screenLine[CMDLINE_LNG];
snprintf(screenLine, getmaxx(stdscr), "History item '%s' deleted (%d occurrence%s)", cmd, occurences, (occurences==1?"":"s"));
if(hstr->view==HSTR_VIEW_FAVORITES) {
snprintf(screenLine, getmaxx(stdscr), "Favorites item '%s' deleted", cmd);
} else {
snprintf(screenLine, getmaxx(stdscr), "History item '%s' deleted (%d occurrence%s)", cmd, occurences, (occurences==1?"":"s"));
}
// TODO make this function
if(hstr->theme & HSTR_THEME_COLOR) {
color_attr_on(COLOR_PAIR(HSTR_COLOR_DELETE));
@ -1036,7 +1044,7 @@ void highlight_selection(int selectionCursorPosition, int previousSelectionCurso
int remove_from_history_model(char* almostDead)
{
if(hstr->view==HSTR_VIEW_FAVORITES) {
return favorites_remove(hstr->favorites, almostDead);
return (int)favorites_remove(hstr->favorites, almostDead);
} else {
// raw & ranked history is pruned first as its items point to system history lines
int systemOccurences=0, rawOccurences=history_mgmt_remove_from_raw(almostDead, hstr->history);