]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0249: clipboard: provider reacts to autoselect feature v9.2.0249
authorFoxe Chen <chen.foxe@gmail.com>
Wed, 25 Mar 2026 21:30:59 +0000 (21:30 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 25 Mar 2026 21:30:59 +0000 (21:30 +0000)
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>
src/clipboard.c
src/testdir/test_eval_stuff.vim
src/version.c

index 0786f29cc064735bf13d24f47027a68353db6a70..e869ae63e9699e5029085b0ecb69615008fb0dec 100644 (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;
index e43bd601bbcfe9ffc726b25e068f1d1842f8a0d4..3ae3b90e4abe0841f14db5b9a96b0476f4e0df41 100644 (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
index c24a1dd1786aef8f64a2560c7f25f9d16a2d1bd0..f25d3cbb69155bba70e2d5b74aed671e65af3f30 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    249,
 /**/
     248,
 /**/