mirror of
https://github.com/dvorka/hstr.git
synced 2024-11-10 09:03:06 +08:00
Merge af2df15ae5
into 4e02bd81bf
This commit is contained in:
commit
a9e57d6df2
2 changed files with 7 additions and 4 deletions
|
@ -338,8 +338,8 @@ void hstr_exit(int status)
|
||||||
void signal_callback_handler_ctrl_c(int signum)
|
void signal_callback_handler_ctrl_c(int signum)
|
||||||
{
|
{
|
||||||
if(signum==SIGINT) {
|
if(signum==SIGINT) {
|
||||||
history_mgmt_flush();
|
|
||||||
hstr_curses_stop(false);
|
hstr_curses_stop(false);
|
||||||
|
history_mgmt_flush();
|
||||||
hstr_exit(signum);
|
hstr_exit(signum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1605,7 +1605,6 @@ void loop_to_select(void)
|
||||||
case K_CTRL_G:
|
case K_CTRL_G:
|
||||||
case K_ESC:
|
case K_ESC:
|
||||||
result=NULL;
|
result=NULL;
|
||||||
history_mgmt_clear_dirty();
|
|
||||||
done=TRUE;
|
done=TRUE;
|
||||||
break;
|
break;
|
||||||
case K_CTRL_X:
|
case K_CTRL_X:
|
||||||
|
@ -1636,6 +1635,9 @@ void loop_to_select(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hstr_curses_stop(hstr->keepPage);
|
hstr_curses_stop(hstr->keepPage);
|
||||||
|
if(deletedOccurences > 0) {
|
||||||
|
history_mgmt_flush();
|
||||||
|
}
|
||||||
|
|
||||||
if(result!=NULL) {
|
if(result!=NULL) {
|
||||||
if(fixCommand) {
|
if(fixCommand) {
|
||||||
|
@ -1683,7 +1685,6 @@ void hstr_interactive(void)
|
||||||
} else {
|
} else {
|
||||||
stdout_history_and_return();
|
stdout_history_and_return();
|
||||||
}
|
}
|
||||||
history_mgmt_flush();
|
|
||||||
} // else (no history) handled in create() method
|
} // else (no history) handled in create() method
|
||||||
|
|
||||||
hstr_exit(EXIT_SUCCESS);
|
hstr_exit(EXIT_SUCCESS);
|
||||||
|
@ -1703,6 +1704,7 @@ void hstr_getopt(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
if(history_mgmt_remove_last_history_entry(hstr->verboseKill)) {
|
if(history_mgmt_remove_last_history_entry(hstr->verboseKill)) {
|
||||||
|
history_mgmt_flush();
|
||||||
hstr_exit(EXIT_SUCCESS);
|
hstr_exit(EXIT_SUCCESS);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -364,6 +364,7 @@ bool history_mgmt_remove_last_history_entry(bool verbose)
|
||||||
free(historyState);
|
free(historyState);
|
||||||
free(historyFile);
|
free(historyFile);
|
||||||
|
|
||||||
|
dirty=true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,6 +407,6 @@ int history_mgmt_remove_from_ranked(char *cmd, HistoryItems *history) {
|
||||||
void history_mgmt_flush(void)
|
void history_mgmt_flush(void)
|
||||||
{
|
{
|
||||||
if(dirty && !is_zsh_parent_shell()) {
|
if(dirty && !is_zsh_parent_shell()) {
|
||||||
fill_terminal_input("history -r\n", false);
|
fill_terminal_input(" \\history -r\n", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue