aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-09-29 19:26:35 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-09-29 19:30:29 -0400
commit37c6cbc7588717c2e1396779d4d69fb3e3263c2d (patch)
treefb83651b14e17c46c2942fd680171bebaa6e87a1
parent621f7b607f977289717f4bea486c96dbe5bf64f3 (diff)
downloadrneovim-37c6cbc7588717c2e1396779d4d69fb3e3263c2d.tar.gz
rneovim-37c6cbc7588717c2e1396779d4d69fb3e3263c2d.tar.bz2
rneovim-37c6cbc7588717c2e1396779d4d69fb3e3263c2d.zip
vim-patch:8.1.1970: search stat space wrong, no test for 8.1.1965
Problem: Search stat space wrong, no test for 8.1.1965. Solution: Fix check for cmd_silent. Add a test. (Christian Brabandt) https://github.com/vim/vim/commit/19e8ac72e9c17b894a9c74cb8f70feb33567033c
-rw-r--r--src/nvim/search.c2
-rw-r--r--src/nvim/testdir/test_search_stat.vim23
2 files changed, 23 insertions, 2 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 091068d385..d379415d62 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -1198,7 +1198,7 @@ int do_search(
// msg_strtrunc() will shorten in the middle.
if (ui_has(kUIMessages)) {
len = 0; // adjusted below
- } else if (msg_scrolled != 0 || cmd_silent) {
+ } else if (msg_scrolled != 0 && !cmd_silent) {
// Use all the columns.
len = (Rows - msg_row) * Columns - 1;
} else {
diff --git a/src/nvim/testdir/test_search_stat.vim b/src/nvim/testdir/test_search_stat.vim
index fa620b4e00..3dd0bec8c9 100644
--- a/src/nvim/testdir/test_search_stat.vim
+++ b/src/nvim/testdir/test_search_stat.vim
@@ -162,8 +162,29 @@ func! Test_search_stat()
let stat = '\[1/2\]'
call assert_notmatch(pat .. stat, g:a)
- " close the window
+ " normal, n comes from a silent mapping
+ " First test a normal mapping, then a silent mapping
+ call cursor(1,1)
+ nnoremap n n
+ let @/ = 'find this'
+ let pat = '/find this\s\+'
+ let g:a = execute(':unsilent :norm n')
+ let g:b = split(g:a, "\n")[-1]
+ let stat = '\[1/2\]'
+ call assert_match(pat .. stat, g:b)
+ nnoremap <silent> n n
+ call cursor(1,1)
+ let g:a = execute(':unsilent :norm n')
+ let g:b = split(g:a, "\n")[-1]
+ let stat = '\[1/2\]'
+ call assert_notmatch(pat .. stat, g:b)
+ call assert_match(stat, g:b)
+ unmap n
+
+ " Clean up
set shortmess+=S
+
+ " close the window
bwipe!
endfunc