aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-09-23 10:11:56 +0200
committerJustin M. Keyes <justinkz@gmail.com>2018-09-23 15:58:01 +0200
commitc3d24368a13d9d0f0b410e098a89056cb5e83c4f (patch)
tree02a6875cbd5120c6a07167fdc0eff89ae3af364e
parent9183e2c67e82b55c6dba19266671d07a6604c0f1 (diff)
downloadrneovim-c3d24368a13d9d0f0b410e098a89056cb5e83c4f.tar.gz
rneovim-c3d24368a13d9d0f0b410e098a89056cb5e83c4f.tar.bz2
rneovim-c3d24368a13d9d0f0b410e098a89056cb5e83c4f.zip
shortmess+=F: Hide :bnext, :bprev fileinfo messages
-rw-r--r--src/nvim/normal.c3
-rw-r--r--test/functional/options/shortmess_spec.lua98
-rw-r--r--test/functional/ui/highlight_spec.lua22
3 files changed, 90 insertions, 33 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 45620bfc54..f87de52a82 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -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;
}
diff --git a/test/functional/options/shortmess_spec.lua b/test/functional/options/shortmess_spec.lua
index 96823476de..5d3863ad0b 100644
--- a/test/functional/options/shortmess_spec.lua
+++ b/test/functional/options/shortmess_spec.lua
@@ -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([[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ "foo" [New File] |
+ ]])
+ eq(1, eval('bufnr("%")'))
+
+ command('set shortmess+=F')
+ feed(':edit bar<CR>')
+ screen:expect([[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ :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([[
- ^ |
- ~ |
- ~ |
- ~ |
- "test" is a directory |
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ :bnext |
]])
- feed_command('set shortmess=F')
- feed_command('e test')
+ eq(2, eval('bufnr("%")'))
+ feed(':bprevious<CR>')
screen:expect([[
- ^ |
- ~ |
- ~ |
- ~ |
- :e test |
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ :bprevious |
]])
+ eq(1, eval('bufnr("%")'))
end)
end)
end)
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 4b6fbc0d74..7f3bf3e97b 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -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)