mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-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 vim/vim#7560)
e4862a0fe6
Remove unused "focus" parameter from "buf_check_timestamp()".
It was meant for removed GUI code.
This commit is contained in:
parent
883114e882
commit
cff4cad25a
@ -1587,7 +1587,7 @@ void enter_buffer(buf_T *buf)
|
|||||||
need_fileinfo = true; // display file info after redraw
|
need_fileinfo = true; // display file info after redraw
|
||||||
}
|
}
|
||||||
// check if file changed
|
// check if file changed
|
||||||
(void)buf_check_timestamp(curbuf, false);
|
(void)buf_check_timestamp(curbuf);
|
||||||
|
|
||||||
curwin->w_topline = 1;
|
curwin->w_topline = 1;
|
||||||
curwin->w_topfill = 0;
|
curwin->w_topfill = 0;
|
||||||
|
@ -805,7 +805,7 @@ static void diff_try_update(diffio_T *dio,
|
|||||||
for (idx_new = idx_orig; idx_new < DB_COUNT; idx_new++) {
|
for (idx_new = idx_orig; idx_new < DB_COUNT; idx_new++) {
|
||||||
buf = curtab->tp_diffbuf[idx_new];
|
buf = curtab->tp_diffbuf[idx_new];
|
||||||
if (buf_valid(buf)) {
|
if (buf_valid(buf)) {
|
||||||
buf_check_timestamp(buf, false);
|
buf_check_timestamp(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2323,7 +2323,7 @@ int do_ecmd(
|
|||||||
// Existing memfile.
|
// Existing memfile.
|
||||||
oldbuf = true;
|
oldbuf = true;
|
||||||
set_bufref(&bufref, buf);
|
set_bufref(&bufref, buf);
|
||||||
(void)buf_check_timestamp(buf, false);
|
(void)buf_check_timestamp(buf);
|
||||||
// Check if autocommands made buffer invalid or changed the current
|
// Check if autocommands made buffer invalid or changed the current
|
||||||
// buffer.
|
// buffer.
|
||||||
if (!bufref_valid(&bufref) || curbuf != old_curbuf.br_buf) {
|
if (!bufref_valid(&bufref) || curbuf != old_curbuf.br_buf) {
|
||||||
|
@ -3392,7 +3392,7 @@ void ex_checktime(exarg_T *eap)
|
|||||||
} else {
|
} else {
|
||||||
buf = buflist_findnr((int)eap->line2);
|
buf = buflist_findnr((int)eap->line2);
|
||||||
if (buf != NULL) { // cannot happen?
|
if (buf != NULL) { // cannot happen?
|
||||||
(void)buf_check_timestamp(buf, false);
|
(void)buf_check_timestamp(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
no_check_timestamps = save_no_check_timestamps;
|
no_check_timestamps = save_no_check_timestamps;
|
||||||
@ -3790,6 +3790,14 @@ void ex_drop(exarg_T *eap)
|
|||||||
if (wp->w_buffer == buf) {
|
if (wp->w_buffer == buf) {
|
||||||
goto_tabpage_win(tp, wp);
|
goto_tabpage_win(tp, wp);
|
||||||
curwin->w_arg_idx = 0;
|
curwin->w_arg_idx = 0;
|
||||||
|
if (!bufIsChanged(curbuf)) {
|
||||||
|
const int save_ar = curbuf->b_p_ar;
|
||||||
|
|
||||||
|
// reload the file if it is newer
|
||||||
|
curbuf->b_p_ar = 1;
|
||||||
|
buf_check_timestamp(curbuf);
|
||||||
|
curbuf->b_p_ar = save_ar;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4675,7 +4675,6 @@ check_timestamps(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
int didit = 0;
|
int didit = 0;
|
||||||
int n;
|
|
||||||
|
|
||||||
/* Don't check timestamps while system() or another low-level function may
|
/* Don't check timestamps while system() or another low-level function may
|
||||||
* cause us to lose and gain focus. */
|
* cause us to lose and gain focus. */
|
||||||
@ -4703,7 +4702,7 @@ check_timestamps(
|
|||||||
if (buf->b_nwindows > 0) {
|
if (buf->b_nwindows > 0) {
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
set_bufref(&bufref, buf);
|
set_bufref(&bufref, buf);
|
||||||
n = buf_check_timestamp(buf, focus);
|
const int n = buf_check_timestamp(buf);
|
||||||
if (didit < n) {
|
if (didit < n) {
|
||||||
didit = n;
|
didit = n;
|
||||||
}
|
}
|
||||||
@ -4773,11 +4772,7 @@ static int move_lines(buf_T *frombuf, buf_T *tobuf)
|
|||||||
* return 2 if a message has been displayed.
|
* return 2 if a message has been displayed.
|
||||||
* return 0 otherwise.
|
* return 0 otherwise.
|
||||||
*/
|
*/
|
||||||
int
|
int buf_check_timestamp(buf_T *buf)
|
||||||
buf_check_timestamp(
|
|
||||||
buf_T *buf,
|
|
||||||
int focus /* called for GUI focus event */
|
|
||||||
)
|
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
@ -61,6 +61,15 @@ func Test_client_server()
|
|||||||
|
|
||||||
call assert_fails('call remote_send("XXX", ":let testvar = ''yes''\<CR>")', 'E241')
|
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.
|
" Expression evaluated locally.
|
||||||
if v:servername == ''
|
if v:servername == ''
|
||||||
call remote_startserver('MYSELF')
|
call remote_startserver('MYSELF')
|
||||||
|
Loading…
Reference in New Issue
Block a user