Commit: patch 9.1.2114: modeless selection not copied to * register

0 views
Skip to first unread message

Christian Brabandt

unread,
Jan 29, 2026, 2:31:27 PMJan 29
to vim...@googlegroups.com
patch 9.1.2114: modeless selection not copied to * register

Commit: https://github.com/vim/vim/commit/0ac59be07128d12327e848264d5a456eb24d7dd0
Author: Foxe Chen <chen...@gmail.com>
Date: Thu Jan 29 19:10:51 2026 +0000

patch 9.1.2114: modeless selection not copied to * register

Problem: modeless selection not copied to * register when P in
guioptions (Coacher)
Solution: Make the "P" flag override the "a" and "A" flag
(Foxe Chen)

fixes: #19187
closes: #19244

Signed-off-by: Foxe Chen <chen...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index fb94aec4d..cdb75dae2 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 9.1. Last change: 2026 Jan 28
+*options.txt* For Vim version 9.1. Last change: 2026 Jan 29


VIM REFERENCE MANUAL by Bram Moolenaar
@@ -4515,8 +4515,8 @@ A jump table for the options with a short description can be found at |Q_op|.
by a yank or delete operation for the "* register.
The same applies to the modeless selection.
*'go-P'*
- 'P' Like autoselect but using the "+ register instead of the "*
- register.
+ 'P' Like autoselect but only copy to the "+ register instead of
+ the "* register.
*'go-A'*
'A' Autoselect for the modeless selection. Like 'a', but only
applies to the modeless selection.
diff --git a/src/clipboard.c b/src/clipboard.c
index 8cf62cf88..6a0473b0a 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -452,11 +452,12 @@ clip_auto_select(void)
int
clip_isautosel_star(void)
{
- return (
-# ifdef FEAT_GUI
- gui.in_use ? (vim_strchr(p_go, GO_ASEL) != NULL) :
-# endif
- clip_autoselect_star);
+#ifdef FEAT_GUI
+ if (gui.in_use)
+ return vim_strchr(p_go, GO_ASEL) != NULL
+ && vim_strchr(p_go, GO_ASELPLUS) == NULL;
+#endif
+ return clip_autoselect_star;
}

/*
@@ -466,11 +467,11 @@ clip_isautosel_star(void)
int
clip_isautosel_plus(void)
{
- return (
-# ifdef FEAT_GUI
- gui.in_use ? (vim_strchr(p_go, GO_ASELPLUS) != NULL) :
-# endif
- clip_autoselect_plus);
+#ifdef FEAT_GUI
+ if (gui.in_use)
+ return vim_strchr(p_go, GO_ASELPLUS) != NULL;
+#endif
+ return clip_autoselect_plus;
}


diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim
index 3837837be..67b0500aa 100644
--- a/src/testdir/test_gui.vim
+++ b/src/testdir/test_gui.vim
@@ -1827,4 +1827,38 @@ func Test_Buffers_Menu()
%bw!
endfunc

+" Test if 'guioptions=a' only copies to the primary selection and
+" 'guioptions=aP' only copies to the regular selection.
+func Test_guioptions_clipboard()
+ CheckX11BasedGui
+
+ set mouse=
+ let save_guioptions = &guioptions
+ set guioptions=a
+
+ let @+ = ""
+ let @* = ""
+
+ call setline(1, ['one two three', 'four five six'])
+ call cursor(1, 1)
+ call feedkeys("\<Esc>vee\<Esc>", "Lx!")
+
+ call assert_equal("one two", @*)
+ call assert_equal("", @+)
+
+ set guioptions=aP
+
+ let @+ = ""
+ let @* = ""
+
+ call cursor(1, 1)
+ call feedkeys("\<Esc>veee\<Esc>", "Lx!")
+
+ call assert_equal("one two three", @+)
+ call assert_equal("", @*)
+
+ set mouse&
+ let &guioptions = save_guioptions
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index f79353e51..a885fd23d 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 */
+/**/
+ 2114,
/**/
2113,
/**/
Reply all
Reply to author
Forward
0 new messages