mirror of
https://github.com/neovim/neovim.git
synced 2026-04-19 14:00:49 +00:00
vim-patch:9.2.0267: 'autowrite' not triggered for :term
Problem: 'autowrite' not triggered for :term
Solution: Trigger autowrite for :term command
(rendcrx)
closes: vim/vim#19855
466b5f531a
Co-authored-by: rendcrx <974449413@qq.com>
This commit is contained in:
@@ -823,7 +823,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
|
||||
|
||||
2
runtime/lua/vim/_meta/options.lua
generated
2
runtime/lua/vim/_meta/options.lua
generated
@@ -190,7 +190,7 @@ vim.go.ar = vim.go.autoread
|
||||
|
||||
--- 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
|
||||
|
||||
@@ -8197,6 +8197,11 @@ static void ex_terminal(exarg_T *eap)
|
||||
{
|
||||
char ex_cmd[1024];
|
||||
size_t len = 0;
|
||||
const int scroll_save = msg_scroll;
|
||||
|
||||
msg_scroll = false; // don't scroll here
|
||||
autowrite_all();
|
||||
msg_scroll = scroll_save;
|
||||
|
||||
if (cmdmod.cmod_tab > 0 || cmdmod.cmod_split != 0) {
|
||||
bool multi_mods = false;
|
||||
|
||||
@@ -324,7 +324,7 @@ local options = {
|
||||
desc = [=[
|
||||
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
|
||||
|
||||
@@ -106,6 +106,17 @@ describe(':terminal', function()
|
||||
eq(3, #jumps)
|
||||
end)
|
||||
|
||||
it("triggers 'autowrite'", function()
|
||||
api.nvim_set_option_value('autowrite', true, {})
|
||||
command('vnew Xtermautowritetestfile | setlocal fileformat=unix')
|
||||
finally(function()
|
||||
os.remove('Xtermautowritetestfile')
|
||||
end)
|
||||
fn.setline(1, 'test content')
|
||||
command('terminal')
|
||||
eq('test content\n', t.read_file('Xtermautowritetestfile'))
|
||||
end)
|
||||
|
||||
it('nvim_get_mode() in :terminal', function()
|
||||
command('terminal')
|
||||
eq({ blocking = false, mode = 'nt' }, api.nvim_get_mode())
|
||||
|
||||
Reference in New Issue
Block a user