]> granicus.if.org Git - vim/commitdiff
patch 8.2.2231: when "--remote file" is used "file" is not reloaded v8.2.2231
authorBram Moolenaar <Bram@vim.org>
Sun, 27 Dec 2020 18:00:24 +0000 (19:00 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 27 Dec 2020 18:00:24 +0000 (19:00 +0100)
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)

src/ex_cmds.c
src/testdir/test_clientserver.vim
src/version.c

index a2b60c9886ab67b6622d725ca82fffa393841afe..734949c336e7d32eeda1ae7f6dccdb1ed0228058 100644 (file)
@@ -5171,6 +5171,15 @@ ex_drop(exarg_T *eap)
            {
                goto_tabpage_win(tp, wp);
                curwin->w_arg_idx = 0;
+               if (!bufIsChanged(curbuf))
+               {
+                   int save_ar = curbuf->b_p_ar;
+
+                   // reload the file if it is newer
+                   curbuf->b_p_ar = TRUE;
+                   buf_check_timestamp(curbuf, FALSE);
+                   curbuf->b_p_ar = save_ar;
+               }
                return;
            }
        }
index 6043184211289cdd2b01e010efc0d33fdaa75fb0..bfad1b28d3c220f691acca95c85caf81eb8d2b50 100644 (file)
@@ -73,6 +73,15 @@ func Test_client_server()
 
   call assert_fails('call remote_send("XXX", ":let testvar = ''yes''\<CR>")', 'E241:')
 
+  call writefile(['one'], 'Xclientfile')
+  let cmd = GetVimProg() .. ' --servername ' .. name .. ' --remote Xclientfile'
+  call system(cmd)
+  call WaitForAssert({-> assert_equal('Xclientfile', remote_expr(name, "bufname()", "", 2))})
+  call WaitForAssert({-> assert_equal('one', remote_expr(name, "getline(1)", "", 2))})
+  call writefile(['one', 'two'], 'Xclientfile')
+  call system(cmd)
+  call WaitForAssert({-> assert_equal('two', remote_expr(name, "getline(2)", "", 2))})
+
   " Expression evaluated locally.
   if v:servername == ''
     eval 'MYSELF'->remote_startserver()
index 51a9e42996e7dc69a3ac3b91286a9aafa582c336..02d03b734385b10a7eef38db741c5ef4cfe7f800 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2231,
 /**/
     2230,
 /**/