Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #348, fix #386 #457

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/hstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,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);
}
}
Expand Down Expand Up @@ -1605,7 +1605,6 @@ void loop_to_select(void)
case K_CTRL_G:
case K_ESC:
result=NULL;
history_mgmt_clear_dirty();
done=TRUE;
break;
case K_CTRL_X:
Expand Down Expand Up @@ -1636,6 +1635,9 @@ void loop_to_select(void)
}
}
hstr_curses_stop(hstr->keepPage);
if(deletedOccurences > 0) {
history_mgmt_flush();
}

if(result!=NULL) {
if(fixCommand) {
Expand Down Expand Up @@ -1683,7 +1685,6 @@ void hstr_interactive(void)
} else {
stdout_history_and_return();
}
history_mgmt_flush();
} // else (no history) handled in create() method

hstr_exit(EXIT_SUCCESS);
Expand All @@ -1703,6 +1704,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 {
Expand Down
3 changes: 2 additions & 1 deletion src/hstr_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ bool history_mgmt_remove_last_history_entry(bool verbose)
free(historyState);
free(historyFile);

dirty=true;
return true;
}

Expand Down Expand Up @@ -406,6 +407,6 @@ int history_mgmt_remove_from_ranked(char *cmd, HistoryItems *history) {
void history_mgmt_flush(void)
{
if(dirty && !is_zsh_parent_shell()) {
fill_terminal_input("history -r\n", false);
fill_terminal_input(" \\history -r\n", false);
}
}