patch 9.2.0249: clipboard: provider reacts to autoselect feature
Commit:
https://github.com/vim/vim/commit/bde58322168a587fc966117f59198de6771ac672
Author: Foxe Chen <
chen...@gmail.com>
Date: Wed Mar 25 21:30:59 2026 +0000
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...@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/src/clipboard.c b/src/clipboard.c
index 0786f29cc..e869ae63e 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -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;
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim
index e43bd601b..3ae3b90e4 100644
--- a/src/testdir/test_eval_stuff.vim
+++ b/src/testdir/test_eval_stuff.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index c24a1dd17..f25d3cbb6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 249,
/**/
248,
/**/