Before this commit, if a terminal buffer was visible in multiple windows, a :mksession would generate a script which would not "re-link" these terminal buffers, duplicating the command across the previously linked windows.
This commit looks handles a terminal buffer that's open in multiple windows, ensuring the buffer is shared between those windows when the session is restored.
https://github.com/vim/vim/pull/6930
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
Before this commit, if a terminal buffer was visible in multiple windows, a
:mksessionwould generate a script which would not "re-link" these terminal buffers, duplicating the command across the previously linked windows.This commit looks handles a terminal buffer that's open in multiple windows, ensuring the buffer is shared between those windows when the session is restored.
@bobrippling pushed 1 commit.
—
You are receiving this because you are subscribed to this thread.
@bobrippling pushed 1 commit.
—
You are receiving this because you are subscribed to this thread.
Sure - added
—
You are receiving this because you commented.
@k-takata commented on this pull request.
coding style
In src/terminal.c:
> term_T *term = wp->w_buffer->b_term;
+ if (wp->w_buffer->b_nwindows > 1) {
⬇️ Suggested change
- if (wp->w_buffer->b_nwindows > 1) {
+ if (wp->w_buffer->b_nwindows > 1)
+ {
In src/terminal.c:
> term_T *term = wp->w_buffer->b_term;
+ if (wp->w_buffer->b_nwindows > 1) {
+ // There are multiple views into this terminal buffer. We don't want to
+ // create the terminal multiple times. If it's the first time, create,
+ // otherwise link to the first buffer.
+ char id_as_str[NUMBUFLEN];
+ hashitem_T *entry;
+
+ vim_snprintf(id_as_str, sizeof(id_as_str), "%d", bufid);
+
+ entry = hash_find(terminal_bufs, (char_u *)id_as_str);
+ if (!HASHITEM_EMPTY(entry)) {
⬇️ Suggested change
- if (!HASHITEM_EMPTY(entry)) {
+ if (!HASHITEM_EMPTY(entry))
+ {
In src/terminal.c:
> @@ -951,6 +970,17 @@ term_write_session(FILE *fd, win_T *wp)
#endif
if (term->tl_command != NULL && fputs((char *)term->tl_command, fd) < 0)
return FAIL;
+ if (put_eol(fd) != OK)
+ return FAIL;
+
+ if (fprintf(fd, "let s:term_buf_%d = bufnr()", bufid) < 0)
+ return FAIL;
+
+ if (wp->w_buffer->b_nwindows > 1) {
⬇️ Suggested change
- if (wp->w_buffer->b_nwindows > 1) {
+ if (wp->w_buffer->b_nwindows > 1)
+ {
—
You are receiving this because you commented.
@bobrippling pushed 1 commit.
—
You are receiving this because you are subscribed to this thread.
@bobrippling pushed 1 commit.
- cecfc44 mksession: link between shared views into a buffer