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); xfree(p);
} }
if (need_fileinfo) { // show file info after redraw // show fileinfo after redraw
if (need_fileinfo && !shortmess(SHM_FILEINFO)) {
fileinfo(false, true, false); fileinfo(false, true, false);
need_fileinfo = false; need_fileinfo = false;
} }

View File

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

View File

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