mirror of
https://github.com/vim/vim.git
synced 2026-05-28 00:21:37 +02:00
patch 9.2.0221: Visual selection drawn incorrectly with "autoselect"
Problem: Visual selection may be drawn incorrectly with "autoselect".
Solution: Restore w_virtcol after getting clipboard selection
(zeertzjq).
fixes: #19590
closes: #19784
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
2f8bd14198
commit
03e89ccf33
+4
-1
@@ -2102,6 +2102,7 @@ clip_get_selection(Clipboard_T *cbd)
|
||||
pos_T old_cursor;
|
||||
pos_T old_visual;
|
||||
int old_visual_mode;
|
||||
colnr_T old_virtcol;
|
||||
colnr_T old_curswant;
|
||||
int old_set_curswant;
|
||||
pos_T old_op_start, old_op_end;
|
||||
@@ -2123,6 +2124,7 @@ clip_get_selection(Clipboard_T *cbd)
|
||||
old_y_previous = get_y_previous();
|
||||
old_y_current = get_y_current();
|
||||
old_cursor = curwin->w_cursor;
|
||||
old_virtcol = curwin->w_virtcol;
|
||||
old_curswant = curwin->w_curswant;
|
||||
old_set_curswant = curwin->w_set_curswant;
|
||||
old_op_start = curbuf->b_op_start;
|
||||
@@ -2143,7 +2145,8 @@ clip_get_selection(Clipboard_T *cbd)
|
||||
set_y_previous(old_y_previous);
|
||||
set_y_current(old_y_current);
|
||||
curwin->w_cursor = old_cursor;
|
||||
changed_cline_bef_curs(); // need to update w_virtcol et al
|
||||
curwin->w_virtcol = old_virtcol;
|
||||
changed_cline_bef_curs(); // old w_virtcol et al. may be invalid
|
||||
curwin->w_curswant = old_curswant;
|
||||
curwin->w_set_curswant = old_set_curswant;
|
||||
curbuf->b_op_start = old_op_start;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|a+0&#ffffff0@4| |a@9|(|a@8| |a@3|)| @42
|
||||
|{| @73
|
||||
@8|a+0#0000001#a8a8a8255|a+0#0000000#ffffff0@21|;| @42
|
||||
@8|a+0#0000001#a8a8a8255|a+0#0000000#ffffff0@21|;| @42
|
||||
@8|a+0#0000001#a8a8a8255|a+0#0000000#ffffff0@21|;| @42
|
||||
@8|a+0#0000001#a8a8a8255|a+0#0000000#ffffff0@21|;| @42
|
||||
@8>a@22|;| @42
|
||||
|}| @73
|
||||
|~+0#4040ff13&| @73
|
||||
|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@28|5|x|1| @6|7|,|2|-|9| @8|A|l@1|
|
||||
@@ -0,0 +1,10 @@
|
||||
|a+0&#ffffff0@4| |a@9|(|a@8| |a@3|)| @42
|
||||
|{| @73
|
||||
@8|a+0#0000001#a8a8a8255@1|a+0#0000000#ffffff0@20|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@1|a+0#0000000#ffffff0@20|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@1|a+0#0000000#ffffff0@20|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@1|a+0#0000000#ffffff0@20|;| @42
|
||||
@8|a+0#0000001#a8a8a8255>a+0#0000000#ffffff0@21|;| @42
|
||||
|}| @73
|
||||
|~+0#4040ff13&| @73
|
||||
|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@28|5|x|2| @6|7|,|3|-|1|0| @7|A|l@1|
|
||||
@@ -0,0 +1,10 @@
|
||||
|a+0&#ffffff0@4| |a@9|(|a@8| |a@3|)| @42
|
||||
|{| @73
|
||||
@8|a+0#0000001#a8a8a8255@2|a+0#0000000#ffffff0@19|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@2|a+0#0000000#ffffff0@19|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@2|a+0#0000000#ffffff0@19|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@2|a+0#0000000#ffffff0@19|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@1>a+0#0000000#ffffff0@20|;| @42
|
||||
|}| @73
|
||||
|~+0#4040ff13&| @73
|
||||
|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@28|5|x|3| @6|7|,|4|-|1@1| @7|A|l@1|
|
||||
@@ -0,0 +1,10 @@
|
||||
|a+0&#ffffff0@4| |a@9|(|a@8| |a@3|)| @42
|
||||
|{| @73
|
||||
@8|a+0#0000001#a8a8a8255@3|a+0#0000000#ffffff0@18|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@3|a+0#0000000#ffffff0@18|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@3|a+0#0000000#ffffff0@18|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@3|a+0#0000000#ffffff0@18|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@2>a+0#0000000#ffffff0@19|;| @42
|
||||
|}| @73
|
||||
|~+0#4040ff13&| @73
|
||||
|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@28|5|x|4| @6|7|,|5|-|1|2| @7|A|l@1|
|
||||
@@ -0,0 +1,10 @@
|
||||
|a+0&#ffffff0@4| |a@9|(|a@8| |a@3|)| @42
|
||||
|{| @73
|
||||
@8|a+0#0000001#a8a8a8255@4|a+0#0000000#ffffff0@17|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@4|a+0#0000000#ffffff0@17|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@4|a+0#0000000#ffffff0@17|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@4|a+0#0000000#ffffff0@17|;| @42
|
||||
@8|a+0#0000001#a8a8a8255@3>a+0#0000000#ffffff0@18|;| @42
|
||||
|}| @73
|
||||
|~+0#4040ff13&| @73
|
||||
|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@28|5|x|5| @6|7|,|6|-|1|3| @7|A|l@1|
|
||||
@@ -0,0 +1,8 @@
|
||||
aaaaa aaaaaaaaaa(aaaaaaaaa aaaa)
|
||||
{
|
||||
aaaaaaaaaaaaaaaaaaaaaaa;
|
||||
aaaaaaaaaaaaaaaaaaaaaaa;
|
||||
aaaaaaaaaaaaaaaaaaaaaaa;
|
||||
aaaaaaaaaaaaaaaaaaaaaaa;
|
||||
aaaaaaaaaaaaaaaaaaaaaaa;
|
||||
}
|
||||
@@ -1618,6 +1618,37 @@ func Test_visual_hl_with_showbreak()
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
" Test for https://github.com/vim/vim/issues/19590
|
||||
func Test_visual_block_hl_with_autoselect()
|
||||
CheckScreendump
|
||||
|
||||
" "autoselect" is included in the default 'clipboard' if available.
|
||||
" Redraw at the end is necessary due to https://github.com/vim/vim/issues/16620
|
||||
let lines =<< trim END
|
||||
set shortmess+=F
|
||||
edit samples/visual_block_hl.txt
|
||||
setlocal filetype=c syntax=c
|
||||
exe "normal! 3gg0l\<C-V>4j"
|
||||
redraw
|
||||
END
|
||||
call writefile(lines, 'XTest_visual_block_autoselect', 'D')
|
||||
|
||||
let buf = RunVimInTerminal('-S XTest_visual_block_autoselect', {'rows': 10})
|
||||
call VerifyScreenDump(buf, 'Test_visual_block_hl_with_autoselect_1', {})
|
||||
call term_sendkeys(buf, 'l')
|
||||
call VerifyScreenDump(buf, 'Test_visual_block_hl_with_autoselect_2', {})
|
||||
call term_sendkeys(buf, 'l')
|
||||
call VerifyScreenDump(buf, 'Test_visual_block_hl_with_autoselect_3', {})
|
||||
call term_sendkeys(buf, 'l')
|
||||
call VerifyScreenDump(buf, 'Test_visual_block_hl_with_autoselect_4', {})
|
||||
call term_sendkeys(buf, 'l')
|
||||
call VerifyScreenDump(buf, 'Test_visual_block_hl_with_autoselect_5', {})
|
||||
|
||||
" clean up
|
||||
call term_sendkeys(buf, "\<Esc>")
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
func Test_visual_highlight_when_using_a_clipboard_provider()
|
||||
" The test assumes different screen attributes will be used for Visual and for VisualNOS.
|
||||
CheckFeature clipboard_provider
|
||||
|
||||
@@ -734,6 +734,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
221,
|
||||
/**/
|
||||
220,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user