vim-patch:8.2.0413: buffer menu does not handle special buffers properly

Problem:    Buffer menu does not handle special buffers properly.
Solution:   Keep a dictionary with buffer names to reliably keep track of
            entries.
            Also trigger BufFilePre and BufFilePost for command-line and
            terminal buffers when the name changes.
5e94a29ebb
This commit is contained in:
zeertzjq
2022-08-05 07:44:25 +08:00
parent c1e1d16fca
commit d985323c55
5 changed files with 115 additions and 49 deletions

View File

@@ -9914,7 +9914,11 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// at this point the buffer has no terminal instance associated yet, so unset
// the 'swapfile' option to ensure no swap file will be created
curbuf->b_p_swf = false;
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, false, curbuf);
(void)setfname(curbuf, (char *)NameBuff, NULL, true);
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, false, curbuf);
// Save the job id and pid in b:terminal_job_{id,pid}
Error err = ERROR_INIT;
// deprecated: use 'channel' buffer option