fix(terminal): assign channel to terminal earlier (#25771)

This commit is contained in:
zeertzjq
2023-10-25 09:59:02 +08:00
committed by GitHub
parent 1094d0c0db
commit 684e93054b
6 changed files with 111 additions and 16 deletions

View File

@@ -1034,9 +1034,12 @@ Integer nvim_open_term(Buffer buffer, DictionaryOf(LuaRef) opts, Error *err)
topts.write_cb = term_write;
topts.resize_cb = term_resize;
topts.close_cb = term_close;
Terminal *term = terminal_open(buf, topts);
terminal_check_size(term);
chan->term = term;
channel_incref(chan);
terminal_open(&chan->term, buf, topts);
if (chan->term != NULL) {
terminal_check_size(chan->term);
}
channel_decref(chan);
return (Integer)chan->id;
}