patch 9.2.0249: clipboard: provider reacts to autoselect feature

Problem:  clipboard: provider reacts to autoselect feature
Solution: Disable autoselection when using clipboard provider feature
          (Foxe Chen).

closes: #19812

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Foxe Chen
2026-03-25 21:30:59 +00:00
committed by Christian Brabandt
parent af3ccc2845
commit bde5832216
3 changed files with 24 additions and 2 deletions
+8
View File
@@ -452,6 +452,10 @@ clip_auto_select(void)
int
clip_isautosel_star(void)
{
# ifdef FEAT_CLIPBOARD_PROVIDER
if (clipmethod == CLIPMETHOD_PROVIDER)
return false;
# endif
# ifdef FEAT_GUI
if (gui.in_use)
return vim_strchr(p_go, GO_ASEL) != NULL
@@ -467,6 +471,10 @@ clip_isautosel_star(void)
int
clip_isautosel_plus(void)
{
# ifdef FEAT_CLIPBOARD_PROVIDER
if (clipmethod == CLIPMETHOD_PROVIDER)
return false;
# endif
# ifdef FEAT_GUI
if (gui.in_use)
return vim_strchr(p_go, GO_ASELPLUS) != NULL;
+14 -2
View File
@@ -1223,7 +1223,7 @@ func Test_clipboard_provider_redir_execute()
endfunc
" Test if clipboard provider feature respects the "unnamed" and "unnamedplus"
" values in the 'clipboard' option
" values in the 'clipboard' option, and ignores the "autoselect" value.
func Test_clipboard_provider_clipboard_option()
CheckFeature clipboard_provider
@@ -1273,6 +1273,19 @@ func Test_clipboard_provider_clipboard_option()
call assert_equal(["testing"], g:vim_copy.lines)
call assert_equal(["testing"], g:vim_copy.lines)
if has('clipboard')
" Test that autoselect option is ignored, this can happen when visual
" selection ends and there is TextYankPost autocmd
set clipboard=autoselect
let g:autoselect_test = 1
au TextYankPost * let g:autoselect_test = 0
call setline(1, "Hello world!")
call cursor(1, 0)
call feedkeys("vww\<Esc>", "x!")
call assert_equal(1, g:autoselect_test)
endif
" Change and delete operations are tested in
" Test_clipboard_provider_accessed_once()
bw!
@@ -1290,5 +1303,4 @@ func Test_clipboard_provider_clipboard_option()
set clipboard&
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+2
View File
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
249,
/**/
248,
/**/