diff options
author | Bart Schaefer <schaefer@zsh.org> | 2013-10-13 10:59:52 -0700 |
---|---|---|
committer | Bart Schaefer <schaefer@zsh.org> | 2013-10-13 10:59:52 -0700 |
commit | 332924513bade9bae205bd8ffd5d0e3f8e8e1d62 (patch) | |
tree | da57173ab6013d0f85e9760447c18a34c3633f93 /Src/hist.c | |
parent | 5faab39a7e87d180e52bb6ebb9bf101f176cc40b (diff) | |
parent | d5ba3ed24579bb12df958c09224367e16e70bad2 (diff) | |
download | zsh-332924513bade9bae205bd8ffd5d0e3f8e8e1d62.tar.gz zsh-332924513bade9bae205bd8ffd5d0e3f8e8e1d62.tar.xz zsh-332924513bade9bae205bd8ffd5d0e3f8e8e1d62.zip |
Merge branch 'master' of git://git.code.sf.net/p/zsh/code
Diffstat (limited to 'Src/hist.c')
-rw-r--r-- | Src/hist.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Src/hist.c b/Src/hist.c index bd650e81e..ed9560952 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -937,12 +937,21 @@ hbegin(int dohist) /* * For INCAPPENDHISTORY, when interactive, save the history here * as it gives a better estimate of the times of commands. + * * If SHAREHISTORY is also set continue to do so in the * standard place, because that's safer about reading and * rewriting history atomically. + * + * The histsave_stack_pos test won't usually fail here. + * We need to test the opposite for the hend() case because we + * need to save in the history file we've switched to, but then + * we pop immediately after that so the variable becomes zero. + * We will already have saved the line and restored the history + * so that (correctly) nothing happens here. But it shows + * I thought about it. */ if (isset(INCAPPENDHISTORY) && !isset(SHAREHISTORY) && - !(histactive & HA_NOINC) && !strin) + !(histactive & HA_NOINC) && !strin && histsave_stack_pos == 0) savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST); } @@ -1348,7 +1357,11 @@ hend(Eprog prog) chline = hptr = NULL; chwords = NULL; histactive = 0; - if (isset(SHAREHISTORY) && histfileIsLocked()) + /* + * For normal INCAPPENDHISTORY case and reasoning, see hbegin(). + */ + if (isset(SHAREHISTORY) ? histfileIsLocked() : + (isset(INCAPPENDHISTORY) && histsave_stack_pos != 0)) savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST); unlockhistfile(hf); /* It's OK to call this even if we aren't locked */ /* |