When doing :edit file
, :split file
, and :vsplit file
last message
is always present in command-line but that is not the case for
:tabedit file
where message blinks and disappears.
Same goes for :tab ...
e.g., :tab help
.
It seems like switching to new tab in those cases does equivalent of
:redraw!
where :redraw
might be just enough and not cause
command-line to be cleared.
—
Reply to this email directly or view it on GitHub.
can you please give a reproducible example, starting with vim -u NONE -N ?
$ touch test.txt
$ vim -u NONE -N -c 'tabedit test.txt'
$ vim -u NONE -N -c 'tab help'
Notice "test.txt" 0L, 0C
/ "help.txt" [readonly] 225L, 8382C
in command-line.
$ vim -u NONE -N
:edit test.txt
:split test.txt
:vsplit test.txt
Notice "test.txt" 0L, 0C
in command-line.
:tabedit test.txt
:tab help
Command-line is empty
Interesting, I don't see those.
Well, I've retested now and figured out that when I open new urxvt
for the first time I don't see it, but then subsequent invocations I do. Interesting, indeed.
Do you see it on :mess? I suppose, there is a redraw happing sometime, which prevents the output.
Yes I do see it there, with my full VIM config I see it even flashing there so yes, there is an equivalent of :redraw!
happening it seems. Question is if just :redraw
wouldn't be enough in this case.
I noticed this just the other day, and I was motivated to fix it.
The problem here is pretty easy to find:
The error in timing occurs in the ex_splitview()
function. Ultimately, the win_new_tabpage()
function invokes redraw_all_later()
with the CLEAR
redraw type. This will remove the fileinfo()
message from the screen before we complete the main loop.
The patch here fixes the problem:
diff --git a/src/window.c b/src/window.c index b9617f037..da93e25e9 100644 --- a/src/window.c +++ b/src/window.c @@ -3702,7 +3702,7 @@ win_new_tabpage(int after) entering_window(curwin); #endif - redraw_all_later(CLEAR); + redraw_all_later(NOT_VALID); apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_TABNEW, NULL, NULL, FALSE, curbuf);
Here, we use the same redraw type as is used in the win_split_ins()
function. This will make :tabedit
and the like leave the same message as the :split
command.
I also discovered that the NeoVim project changed this exact line in the same way. You can view the commit message here.
I tried to formulate a test for this problem to prove that it was fixed, but redrawing operations are suppressed within functions to the point that I could not make the test fail as one would expect from interactive use. My attempt at a test is below:
diff --git a/src/testdir/test_tabpage.vim b/src/testdir/test_tabpage.vim index add9b3d7c..efaf22767 100644 --- a/src/testdir/test_tabpage.vim +++ b/src/testdir/test_tabpage.vim @@ -547,4 +547,24 @@ func Test_tabs() bw! endfunc +func Test_new_tabpage_fileinfo() + %bw + + let sp_fileinfo = '' + let tabe_fileinfo = '' + + sp foo + redraw + for i in range(1, &columns) + let sp_fileinfo .= nr2char(screenchar(&lines - &cmdheight + 1, i)) + endfor + %bw | redraw! + tabe foo + redraw + for i in range(1, &columns) + let tabe_fileinfo .= nr2char(screenchar(&lines - &cmdheight + 1, i)) + endfor + call assert_equal(sp_fileinfo, tabe_fileinfo) +endfunc + " vim: shiftwidth=2 sts=2 expandtab
@brammool, is this kind of change acceptable without a test? Do you think this test could be made to work?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub