shortmess+=F: Hide :bnext, :bprev fileinfo messages

This commit is contained in:
Justin M. Keyes 2018-09-23 10:11:56 +02:00
parent 9183e2c67e
commit c3d24368a1
3 changed files with 90 additions and 33 deletions

View File

@ -1269,7 +1269,8 @@ static void normal_redraw(NormalState *s)
xfree(p);
}
if (need_fileinfo) { // show file info after redraw
// show fileinfo after redraw
if (need_fileinfo && !shortmess(SHM_FILEINFO)) {
fileinfo(false, true, false);
need_fileinfo = false;
}

View File

@ -1,7 +1,11 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local command = helpers.command
local clear, feed_command = helpers.clear, helpers.feed_command
local clear = helpers.clear
local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
if helpers.pending_win32(pending) then return end
@ -10,34 +14,86 @@ describe("'shortmess'", function()
before_each(function()
clear()
screen = Screen.new(25, 5)
screen = Screen.new(42, 5)
screen:attach()
end)
after_each(function()
screen:detach()
end)
describe('"F" flag', function()
it('hides messages about the files read', function()
command("set shortmess-=F")
feed_command('e test')
it('hides :edit fileinfo messages', function()
command('set hidden')
command('set shortmess-=F')
feed(':edit foo<CR>')
screen:expect([[
^ |
~ |
~ |
~ |
"test" is a directory |
^ |
~ |
~ |
~ |
"foo" [New File] |
]])
feed_command('set shortmess=F')
feed_command('e test')
eq(1, eval('bufnr("%")'))
command('set shortmess+=F')
feed(':edit bar<CR>')
screen:expect([[
^ |
~ |
~ |
~ |
:e test |
^ |
~ |
~ |
~ |
:edit bar |
]])
eq(2, eval('bufnr("%")'))
end)
it('hides :bnext, :bprevious fileinfo messages', function()
command('set hidden')
command('set shortmess-=F')
feed(':edit foo<CR>')
screen:expect([[
^ |
~ |
~ |
~ |
"foo" [New File] |
]])
eq(1, eval('bufnr("%")'))
feed(':edit bar<CR>')
screen:expect([[
^ |
~ |
~ |
~ |
"bar" [New File] |
]])
eq(2, eval('bufnr("%")'))
feed(':bprevious<CR>')
screen:expect([[
^ |
~ |
~ |
~ |
"foo" [New file] --No lines in buffer-- |
]])
eq(1, eval('bufnr("%")'))
command('set shortmess+=F')
feed(':bnext<CR>')
screen:expect([[
^ |
~ |
~ |
~ |
:bnext |
]])
eq(2, eval('bufnr("%")'))
feed(':bprevious<CR>')
screen:expect([[
^ |
~ |
~ |
~ |
:bprevious |
]])
eq(1, eval('bufnr("%")'))
end)
end)
end)

View File

@ -40,24 +40,24 @@ describe('highlight: `:syntax manual`', function()
end)
it("works with buffer switch and 'hidden'", function()
feed_command('e tmp1.vim')
feed_command('e Xtest-functional-ui-highlight.tmp.vim')
feed_command('filetype on')
feed_command('syntax manual')
feed_command('set ft=vim')
feed_command('set syntax=ON')
command('e tmp1.vim')
command('e Xtest-functional-ui-highlight.tmp.vim')
command('filetype on')
command('syntax manual')
command('set ft=vim')
command('set syntax=ON')
feed('iecho 1<esc>0')
feed_command('set hidden')
feed_command('w')
feed_command('bn')
command('set hidden')
command('w')
command('bn')
feed_command('bp')
screen:expect([[
{1:^echo} 1 |
{0:~ }|
{0:~ }|
{0:~ }|
<f 1 --100%-- col 1 |
:bp |
]])
end)
@ -919,7 +919,7 @@ describe("'winhighlight' highlight", function()
aa |
{0:~ }|
{4:[No Name] [+] }|
<f 1 --100%-- col 1 |
|
]])
end)