fix(terminal): losing output if BufFile* poll for events (#37580)

Problem:  Terminal loses output if a BufFilePre or BufFilePost autocmd
          polls for events.
Solution: Rename the buffer after allocating the terminal instance. Also
          fix buffer getting wrong name if BufFilePre uses NameBuff.
This commit is contained in:
zeertzjq
2026-01-28 06:21:28 +08:00
committed by GitHub
parent d96a88252e
commit df21ac729c
6 changed files with 141 additions and 55 deletions

View File

@@ -1155,7 +1155,8 @@ Integer nvim_open_term(Buffer buffer, Dict(open_term) *opts, Error *err)
}
channel_incref(chan);
terminal_open(&chan->term, buf, topts);
chan->term = terminal_alloc(buf, topts);
terminal_open(&chan->term, buf);
if (chan->term != NULL) {
terminal_check_size(chan->term);
}