Skip to content

Commit e4862a0

Browse files
committed
patch 8.2.2231: when "--remote file" is used "file" is not reloaded
Problem: When "--remote file" is used "file" is not reloaded. Solution: When a :drop command is used for a file that is already displayed in a window and it has not been changed, check if it needs to be reloaded. (closes #7560)
1 parent 179eb56 commit e4862a0

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/ex_cmds.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5171,6 +5171,15 @@ ex_drop(exarg_T *eap)
51715171
{
51725172
goto_tabpage_win(tp, wp);
51735173
curwin->w_arg_idx = 0;
5174+
if (!bufIsChanged(curbuf))
5175+
{
5176+
int save_ar = curbuf->b_p_ar;
5177+
5178+
// reload the file if it is newer
5179+
curbuf->b_p_ar = TRUE;
5180+
buf_check_timestamp(curbuf, FALSE);
5181+
curbuf->b_p_ar = save_ar;
5182+
}
51745183
return;
51755184
}
51765185
}

src/testdir/test_clientserver.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ func Test_client_server()
7373

7474
call assert_fails('call remote_send("XXX", ":let testvar = ''yes''\<CR>")', 'E241:')
7575

76+
call writefile(['one'], 'Xclientfile')
77+
let cmd = GetVimProg() .. ' --servername ' .. name .. ' --remote Xclientfile'
78+
call system(cmd)
79+
call WaitForAssert({-> assert_equal('Xclientfile', remote_expr(name, "bufname()", "", 2))})
80+
call WaitForAssert({-> assert_equal('one', remote_expr(name, "getline(1)", "", 2))})
81+
call writefile(['one', 'two'], 'Xclientfile')
82+
call system(cmd)
83+
call WaitForAssert({-> assert_equal('two', remote_expr(name, "getline(2)", "", 2))})
84+
7685
" Expression evaluated locally.
7786
if v:servername == ''
7887
eval 'MYSELF'->remote_startserver()

src/version.c

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

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2231,
753755
/**/
754756
2230,
755757
/**/

0 commit comments

Comments
 (0)