Skip to content

Commit 466b5f5

Browse files
rendcrxchrisbra
authored andcommitted
patch 9.2.0267: 'autowrite' not triggered for :term
Problem: 'autowrite' not triggered for :term Solution: Trigger autowrite for :term command (rendcrx) closes: #19855 Signed-off-by: rendcrx <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 8ea5f27 commit 466b5f5

4 files changed

Lines changed: 20 additions & 2 deletions

File tree

runtime/doc/options.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*options.txt* For Vim version 9.2. Last change: 2026 Mar 23
1+
*options.txt* For Vim version 9.2. Last change: 2026 Mar 29
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1031,7 +1031,7 @@ A jump table for the options with a short description can be found at |Q_op|.
10311031
global
10321032
Write the contents of the file, if it has been modified, on each
10331033
`:next`, `:rewind`, `:last`, `:first`, `:previous`, `:stop`,
1034-
`:suspend`, `:tag`, `:!`, `:make`, CTRL-] and CTRL-^ command; and when
1034+
`:suspend`, `:tag`, `:!`, `:make`, `:terminal`, CTRL-] and CTRL-^ command; and when
10351035
a `:buffer`, CTRL-O, CTRL-I, '{A-Z0-9}, or `{A-Z0-9} command takes one
10361036
to another file.
10371037
A buffer is not written if it becomes hidden, e.g. when 'bufhidden' is

src/terminal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,11 @@ ex_terminal(exarg_T *eap)
810810
int opt_shell = FALSE;
811811
char_u *cmd;
812812
char_u *tofree = NULL;
813+
int scroll_save = msg_scroll;
814+
815+
msg_scroll = FALSE; // don't scroll here
816+
autowrite_all();
817+
msg_scroll = scroll_save;
813818

814819
init_job_options(&opt);
815820

src/testdir/test_terminal3.vim

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,4 +1218,15 @@ func Test_term_getpos()
12181218
bw
12191219
endfunc
12201220

1221+
func Test_term_autowrite()
1222+
set autowrite
1223+
new termautowritetestfile
1224+
call setline(1, 'test content')
1225+
term echo "test"
1226+
call assert_equal(['test content'], readfile('termautowritetestfile'))
1227+
call delete('termautowritetestfile')
1228+
bwipe!
1229+
set noautowrite
1230+
endfunc
1231+
12211232
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
267,
737739
/**/
738740
266,
739741
/**/

0 commit comments

Comments
 (0)