diff --git a/src/hstr.c b/src/hstr.c index b0ee33f8..9ff68a11 100644 --- a/src/hstr.c +++ b/src/hstr.c @@ -400,8 +400,8 @@ void hstr_exit(int status) void signal_callback_handler_ctrl_c(int signum) { if(signum==SIGINT) { - history_mgmt_flush(); hstr_curses_stop(false); + history_mgmt_flush(); hstr_exit(signum); } } @@ -1615,6 +1615,9 @@ void loop_to_select(void) } } hstr_curses_stop(hstr->keepPage); + if(deletedOccurences > 0) { + history_mgmt_flush(); + } if(result!=NULL) { if(fixCommand) { @@ -1661,7 +1664,6 @@ void hstr_interactive(void) } else { stdout_history_and_return(); } - history_mgmt_flush(); } // else (no history) handled in create() method hstr_exit(EXIT_SUCCESS); @@ -1681,6 +1683,7 @@ void hstr_getopt(int argc, char **argv) break; case 'k': if(history_mgmt_remove_last_history_entry(hstr->verboseKill)) { + history_mgmt_flush(); hstr_exit(EXIT_SUCCESS); break; } else { diff --git a/src/hstr_history.c b/src/hstr_history.c index 8dcc86b6..674b38e7 100644 --- a/src/hstr_history.c +++ b/src/hstr_history.c @@ -361,6 +361,7 @@ bool history_mgmt_remove_last_history_entry(bool verbose) free(historyState); free(historyFile); + dirty=true; return true; } @@ -403,6 +404,6 @@ int history_mgmt_remove_from_ranked(char *cmd, HistoryItems *history) { void history_mgmt_flush(void) { if(dirty && !isZshParentShell()) { - fill_terminal_input("history -r\n", false); + fill_terminal_input(" \\history -r\n", false); } }