Patch 8.2.3624

7 views
Skip to first unread message

Bram Moolenaar

unread,
Nov 19, 2021, 12:01:48 PM11/19/21
to vim...@googlegroups.com

Patch 8.2.3624
Problem: When renaming a terminal buffer the status text is not updated.
Solution: Clear the cached status text when renaming a terminal buffer.
(closes #9162)
Files: src/buffer.c, src/terminal.c, src/proto/terminal.pro,
src/testdir/test_terminal.vim


*** ../vim-8.2.3623/src/buffer.c 2021-11-18 18:52:08.824648758 +0000
--- src/buffer.c 2021-11-19 15:38:41.088837906 +0000
***************
*** 3453,3458 ****
--- 3453,3463 ----
if (buf->b_ml.ml_mfp != NULL)
ml_setname(buf);

+ #ifdef FEAT_TERMINAL
+ if (buf->b_term != NULL)
+ term_clear_status_text(buf->b_term);
+ #endif
+
if (curwin->w_buffer == buf)
check_arg_idx(curwin); // check file name for arg list
#ifdef FEAT_TITLE
*** ../vim-8.2.3623/src/terminal.c 2021-11-15 17:13:07.342685617 +0000
--- src/terminal.c 2021-11-19 15:30:29.301511323 +0000
***************
*** 4638,4643 ****
--- 4638,4652 ----
}

/*
+ * Clear the cached value of the status text.
+ */
+ void
+ term_clear_status_text(term_T *term)
+ {
+ VIM_CLEAR(term->tl_status_text);
+ }
+
+ /*
* Mark references in jobs of terminals.
*/
int
*** ../vim-8.2.3623/src/proto/terminal.pro 2021-10-15 22:25:37.785385044 +0100
--- src/proto/terminal.pro 2021-11-19 15:31:34.969427640 +0000
***************
*** 31,36 ****
--- 31,37 ----
void term_update_colors(term_T *term);
void term_update_colors_all(void);
char_u *term_get_status_text(term_T *term);
+ void term_clear_status_text(term_T *term);
int set_ref_in_term(int copyID);
void f_term_dumpwrite(typval_T *argvars, typval_T *rettv);
int term_swap_diff(void);
*** ../vim-8.2.3623/src/testdir/test_terminal.vim 2021-11-13 10:27:34.387764064 +0000
--- src/testdir/test_terminal.vim 2021-11-19 15:37:36.540931156 +0000
***************
*** 159,164 ****
--- 159,176 ----
bwipe Xasdfasdf
endfunc

+ func Test_terminal_rename_buffer()
+ let cmd = Get_cat_123_cmd()
+ let buf = term_start(cmd, {'term_name': 'foo'})
+ call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))})
+ call assert_equal('foo', bufname())
+ call assert_match('foo.*finished', execute('ls'))
+ file bar
+ call assert_equal('bar', bufname())
+ call assert_match('bar.*finished', execute('ls'))
+ exe 'bwipe! ' .. buf
+ endfunc
+
func s:Nasty_exit_cb(job, st)
exe g:buf . 'bwipe!'
let g:buf = 0
*** ../vim-8.2.3623/src/version.c 2021-11-19 12:37:31.991899942 +0000
--- src/version.c 2021-11-19 15:29:09.305609603 +0000
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 3624,
/**/

--
TALL KNIGHT: We are now no longer the Knights Who Say Ni!
ONE KNIGHT: Ni!
OTHERS: Sh!
ONE KNIGHT: (whispers) Sorry.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages