aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-09-29 19:45:32 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-09-29 21:36:00 -0400
commit83ebe0c9988bd4abeda0f7ca0775d50e050b9e55 (patch)
tree8dba16a238f44ebec66af02fd15b92d0fc796b2c
parenta307489a79450a0f54282f11203ae68577505ab4 (diff)
downloadrneovim-83ebe0c9988bd4abeda0f7ca0775d50e050b9e55.tar.gz
rneovim-83ebe0c9988bd4abeda0f7ca0775d50e050b9e55.tar.bz2
rneovim-83ebe0c9988bd4abeda0f7ca0775d50e050b9e55.zip
vim-patch:8.1.1992: the search stat moves when wrapping at the end of the buffer
Problem: The search stat moves when wrapping at the end of the buffer. Solution: Put the "W" in front instead of at the end. https://github.com/vim/vim/commit/16b58ae9f36e9675c34d942f5d5f8c8a7914dbc4
-rw-r--r--src/nvim/search.c4
-rw-r--r--src/nvim/testdir/test_search_stat.vim10
-rw-r--r--test/functional/ui/messages_spec.lua2
3 files changed, 9 insertions, 7 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c
index d379415d62..a3acf0c27d 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -4359,7 +4359,9 @@ static void search_stat(int dirc, pos_T *pos,
len = STRLEN(t);
if (show_top_bot_msg && len + 2 < SEARCH_STAT_BUF_LEN) {
- STRCPY(t + len, " W");
+ memmove(t + 2, t, len);
+ t[0] = 'W';
+ t[1] = ' ';
len += 2;
}
diff --git a/src/nvim/testdir/test_search_stat.vim b/src/nvim/testdir/test_search_stat.vim
index 1188c220e1..c1957497f4 100644
--- a/src/nvim/testdir/test_search_stat.vim
+++ b/src/nvim/testdir/test_search_stat.vim
@@ -43,7 +43,7 @@ func Test_search_stat()
call assert_match(pat .. stat, g:a)
call cursor(line('$'), 1)
let g:a = execute(':unsilent :norm! n')
- let stat = '\[1/>99\] W'
+ let stat = 'W \[1/>99\]'
call assert_match(pat .. stat, g:a)
" Many matches
@@ -53,7 +53,7 @@ func Test_search_stat()
call assert_match(pat .. stat, g:a)
call cursor(1, 1)
let g:a = execute(':unsilent :norm! N')
- let stat = '\[>99/>99\] W'
+ let stat = 'W \[>99/>99\]'
call assert_match(pat .. stat, g:a)
" right-left
@@ -85,7 +85,7 @@ func Test_search_stat()
call cursor('$',1)
let pat = 'raboof/\s\+'
let g:a = execute(':unsilent :norm! n')
- let stat = '\[20/1\]'
+ let stat = 'W \[20/1\]'
call assert_match(pat .. stat, g:a)
call assert_match('search hit BOTTOM, continuing at TOP', g:a)
set norl
@@ -96,10 +96,10 @@ func Test_search_stat()
let @/ = 'foobar'
let pat = '?foobar\s\+'
let g:a = execute(':unsilent :norm! N')
- let stat = '\[20/20\]'
+ let stat = 'W \[20/20\]'
call assert_match(pat .. stat, g:a)
call assert_match('search hit TOP, continuing at BOTTOM', g:a)
- call assert_match('\[20/20\] W', Screenline(&lines))
+ call assert_match('W \[20/20\]', Screenline(&lines))
" normal, no match
call cursor(1,1)
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
index efc02db159..5df4a1d533 100644
--- a/test/functional/ui/messages_spec.lua
+++ b/test/functional/ui/messages_spec.lua
@@ -323,7 +323,7 @@ describe('ui/ext_messages', function()
{1:~ }|
{1:~ }|
]], messages={
- {content = {{"/line [1/2] W"}}, kind = "search_count"}
+ {content = {{"/line W [1/2]"}}, kind = "search_count"}
}}
feed('n')