patch 9.2.0267: 'autowrite' not triggered for :term
Commit:
https://github.com/vim/vim/commit/466b5f531a9818d4fa834126d64e8b771e4a497f
Author: rendcrx <[email protected]>
Date: Sun Mar 29 09:20:34 2026 +0000
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]>
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 5f30fb715..f17f6259d 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 9.2. Last change: 2026 Mar 23
+*options.txt* For Vim version 9.2. Last change: 2026 Mar 29
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|.
global
Write the contents of the file, if it has been modified, on each
`:next`, `:rewind`, `:last`, `:first`, `:previous`, `:stop`,
- `:suspend`, `:tag`, `:!`, `:make`, CTRL-] and CTRL-^ command; and when
+ `:suspend`, `:tag`, `:!`, `:make`, `:terminal`, CTRL-] and CTRL-^
command; and when
a `:buffer`, CTRL-O, CTRL-I, '{A-Z0-9}, or `{A-Z0-9} command takes one
to another file.
A buffer is not written if it becomes hidden, e.g. when 'bufhidden' is
diff --git a/src/terminal.c b/src/terminal.c
index 8140da55f..ecb0b52b3 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -810,6 +810,11 @@ ex_terminal(exarg_T *eap)
int opt_shell = FALSE;
char_u *cmd;
char_u *tofree = NULL;
+ int scroll_save = msg_scroll;
+
+ msg_scroll = FALSE; // don't scroll here
+ autowrite_all();
+ msg_scroll = scroll_save;
init_job_options(&opt);
diff --git a/src/testdir/test_terminal3.vim b/src/testdir/test_terminal3.vim
index 7cf727e49..263b5f309 100644
--- a/src/testdir/test_terminal3.vim
+++ b/src/testdir/test_terminal3.vim
@@ -1218,4 +1218,15 @@ func Test_term_getpos()
bw
endfunc
+func Test_term_autowrite()
+ set autowrite
+ new termautowritetestfile
+ call setline(1, 'test content')
+ term echo "test"
+ call assert_equal(['test content'], readfile('termautowritetestfile'))
+ call delete('termautowritetestfile')
+ bwipe!
+ set noautowrite
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 5a1fd0cd7..d2797c237 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 267,
/**/
266,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1w6qgS-00Bkld-Tz%40256bit.org.