patch 9.1.1863: Cannot test for working "+" register
Commit:
https://github.com/vim/vim/commit/f22cedd75fa30e046e96ace4b2f54d8dca601ed2
Author: Foxe Chen <
chen...@gmail.com>
Date: Thu Oct 16 19:11:37 2025 +0000
patch 9.1.1863: Cannot test for working "+" register
Problem: Cannot test for working "+" register
Solution: Add a few more feature tests (Foxe Chen)
closes: #18541
Signed-off-by: Foxe Chen <
chen...@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 787e59ed8..6a53471f9 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -1411,7 +1411,9 @@ $quote eval.txt /*$quote*
+cindent various.txt /*+cindent*
+clientserver various.txt /*+clientserver*
+clipboard various.txt /*+clipboard*
++clipboard_plus_avail various.txt /*+clipboard_plus_avail*
+clipboard_provider various.txt /*+clipboard_provider*
++clipboard_star_avail various.txt /*+clipboard_star_avail*
+clipboard_working various.txt /*+clipboard_working*
+cmd editing.txt /*+cmd*
+cmdline_compl various.txt /*+cmdline_compl*
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index 78777eef5..c7ed02764 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -1,4 +1,4 @@
-*various.txt* For Vim version 9.1. Last change: 2025 Oct 14
+*various.txt* For Vim version 9.1. Last change: 2025 Oct 16
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -380,6 +380,12 @@ N *+clientserver* Unix and Win32: Remote invocation |clientserver|
*+clipboard* |clipboard| support compiled-in
N *+clipboard_provider* |clipboard-providers| support compiled-in
*+clipboard_working* |clipboard| support compiled-in and working
+ *+clipboard_star_avail*
+ |clipboard| support compiled-in and star "*" register
+ available
+ *+clipboard_plus_avail*
+ |clipboard| support compiled-in and separate plus "+"
+ register available
T *+cmdline_compl* command line completion |cmdline-completion|
T *+cmdline_hist* command line history |cmdline-history|
T *+cmdline_info* 'showcmd' and 'ruler'; Always enabled since
diff --git a/src/clipboard.c b/src/clipboard.c
index f289879dd..e51138669 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -3573,7 +3573,6 @@ get_clipmethod(char_u *str, bool *plus UNUSED, bool *star)
#endif
*star = star_avail == 1;
}
-
else if (
#ifndef ONE_CLIPBOARD
plus_avail == -1 ||
@@ -3585,7 +3584,6 @@ get_clipmethod(char_u *str, bool *plus UNUSED, bool *star)
goto exit;
}
}
-
// Keep on going in order to catch errors
if (method != CLIPMETHOD_NONE && ret == CLIPMETHOD_FAIL)
ret = method;
diff --git a/src/evalfunc.c b/src/evalfunc.c
index e2e9bcbef..17e7adbcb 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -7929,8 +7929,22 @@ f_has(typval_T *argvars, typval_T *rettv)
else if (STRICMP(name, "clipboard_working") == 0)
{
x = TRUE;
+#ifdef FEAT_CLIPBOARD
+ n = clip_star.available || clip_plus.available;
+#endif
+ }
+ else if (STRICMP(name, "clipboard_star_avail") == 0)
+ {
+ x = TRUE;
#ifdef FEAT_CLIPBOARD
n = clip_star.available;
+#endif
+ }
+ else if (STRICMP(name, "clipboard_plus_avail") == 0)
+ {
+ x = TRUE;
+#ifdef FEAT_CLIPBOARD
+ n = clip_plus.available && &clip_star != &clip_plus;
#endif
}
}
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim
index 39bb4ba9f..0e5c7e923 100644
--- a/src/testdir/test_eval_stuff.vim
+++ b/src/testdir/test_eval_stuff.vim
@@ -727,4 +727,48 @@ func Test_eval_string_in_special_key()
silent! echo 0{1-$"\<S--{> n|nö%
endfunc
+func AvailableTest()
+ return g:vim_test_plus .. g:vim_test_star
+endfunc
+
+func Test_clipboard_runtime_features()
+ " Use clipboard provider because we can change if a register is available or
+ " not.
+ CheckFeature clipboard_provider
+ CheckFeature clipboard
+
+ let g:vim_test_plus = ''
+ let g:vim_test_star = ''
+
+ let v:clipproviders["evaltest"] = {
+ \ "available": function("AvailableTest")
+ \ }
+
+ set clipmethod=evaltest
+
+ if has('win32') || has('macunix')
+ let g:vim_test_plus = '+'
+ let g:vim_test_star = '*'
+ clipreset
+
+ " plus register should be disabled on windows or macos
+ call assert_equal(0, has('clipboard_plus_avail'))
+ call assert_equal(1, has('clipboard_star_avail'))
+ else
+ let g:vim_test_plus = '+'
+ let g:vim_test_star = '*'
+ clipreset
+
+ call assert_equal(1, has('clipboard_plus_avail'))
+ call assert_equal(1, has('clipboard_star_avail'))
+
+ let g:vim_test_plus = ""
+ clipreset
+
+ call assert_equal(0, has('clipboard_plus_avail'))
+ endif
+
+ set clipmethod&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 969ac9cc9..9e05de8a3 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 */
+/**/
+ 1863,
/**/
1862,
/**/