summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-05-30 16:43:11 +0200
committerBram Moolenaar <Bram@vim.org>2021-05-30 16:43:11 +0200
commite71c0ebe2cee4a4916c49e206733200299e4c065 (patch)
tree69625871cfda6378539fadb2b604cc388bff6cdf
parent0b49648486c5857047433c11d0871f79b53613a5 (diff)
downloadvim-git-e71c0ebe2cee4a4916c49e206733200299e4c065.tar.gz
patch 8.2.2911: pattern "\%V" does not match all of block selectionv8.2.2911
Problem: Pattern "\%V" does not match all of block selection. (Rick Howe) Solution: Use the value of vi_curswant. (closes #8285)
-rw-r--r--src/regexp.c5
-rw-r--r--src/testdir/dumps/Test_hlsearch_block_visual_match.dump9
-rw-r--r--src/testdir/test_search.vim20
-rw-r--r--src/version.c2
4 files changed, 35 insertions, 1 deletions
diff --git a/src/regexp.c b/src/regexp.c
index e372dd44d..8c1431d3c 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -1279,6 +1279,7 @@ reg_match_visual(void)
colnr_T start, end;
colnr_T start2, end2;
colnr_T cols;
+ colnr_T curswant;
// Check if the buffer is the current buffer.
if (rex.reg_buf != curbuf || VIsual.lnum == 0)
@@ -1297,6 +1298,7 @@ reg_match_visual(void)
bot = VIsual;
}
mode = VIsual_mode;
+ curswant = wp->w_curswant;
}
else
{
@@ -1311,6 +1313,7 @@ reg_match_visual(void)
bot = curbuf->b_visual.vi_start;
}
mode = curbuf->b_visual.vi_mode;
+ curswant = curbuf->b_visual.vi_curswant;
}
lnum = rex.lnum + rex.reg_firstlnum;
if (lnum < top.lnum || lnum > bot.lnum)
@@ -1331,7 +1334,7 @@ reg_match_visual(void)
start = start2;
if (end2 > end)
end = end2;
- if (top.col == MAXCOL || bot.col == MAXCOL)
+ if (top.col == MAXCOL || bot.col == MAXCOL || curswant == MAXCOL)
end = MAXCOL;
cols = win_linetabsize(wp, rex.line, (colnr_T)(rex.input - rex.line));
if (cols < start || cols > end - (*p_sel == 'e'))
diff --git a/src/testdir/dumps/Test_hlsearch_block_visual_match.dump b/src/testdir/dumps/Test_hlsearch_block_visual_match.dump
new file mode 100644
index 000000000..0b4567845
--- /dev/null
+++ b/src/testdir/dumps/Test_hlsearch_block_visual_match.dump
@@ -0,0 +1,9 @@
+|a+0&#ffff4012@1| | +0&#ffffff0@56
+>b+0&#ffff4012@3| | +0&#ffffff0@54
+|c+0&#ffff4012@5| | +0&#ffffff0@52
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|~| @58
+|/+0#0000000&|\|%|V| @37|2|,|1| @10|A|l@1|
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index b265e97de..49e86f872 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -984,6 +984,26 @@ func Test_hlsearch_and_visual()
call delete('Xhlvisual_script')
endfunc
+func Test_hlsearch_block_visual_match()
+ CheckScreendump
+
+ let lines =<< trim END
+ set hlsearch
+ call setline(1, ['aa', 'bbbb', 'cccccc'])
+ END
+ call writefile(lines, 'Xhlsearch_block')
+ let buf = RunVimInTerminal('-S Xhlsearch_block', {'rows': 9, 'cols': 60})
+
+ call term_sendkeys(buf, "G\<C-V>$kk\<Esc>")
+ sleep 100m
+ call term_sendkeys(buf, "/\\%V\<CR>")
+ sleep 100m
+ call VerifyScreenDump(buf, 'Test_hlsearch_block_visual_match', {})
+
+ call StopVimInTerminal(buf)
+ call delete('Xhlsearch_block')
+endfunc
+
func Test_incsearch_substitute()
CheckOption incsearch
diff --git a/src/version.c b/src/version.c
index 8440b8285..0a82a96f6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2911,
+/**/
2910,
/**/
2909,