]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(osc52): Omit paste from the osc52 provider when g:osc52_disable_paste is...
authormikoto2000 <mikoto2000@gmail.com>
Sun, 1 Mar 2026 19:23:34 +0000 (19:23 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 1 Mar 2026 19:23:34 +0000 (19:23 +0000)
Omit paste capability from the osc52 provider when g:osc52_disable_paste
is enabled This avoids OSC 52 paste queries on unsupported terminals and
prevents the +/* registers from being treated as empty. Documentation
updated accordingly.

related: #18983
closes:  #19542

Signed-off-by: mikoto2000 <mikoto2000@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/pack/dist/opt/osc52/doc/osc52.txt
runtime/pack/dist/opt/osc52/plugin/osc52.vim

index 97a63289ce9be5f8d6c75d79e959996bee9fca47..7ac73c076d15f2490632c07f89e022521d7a56ae 100644 (file)
@@ -62,9 +62,10 @@ setting |g:osc52_force_avail| to true.
 
                                                         *g:osc52_disable_paste*
 If your terminal does not support pasting via OSC 52, or has it disabled, then
-it is a good idea to set g:osc52_disable_paste to TRUE.  This will cause an
-empty string to be returned when Vim attempts to query the osc52.vim provider,
-instead of doing a blocking wait, as said in |osc52-support|.
+it is a good idea to set g:osc52_disable_paste to TRUE.  This will register
+only the "copy" method for the osc52.vim clipboard provider, so Vim will not
+attempt an OSC 52 paste query and avoids the blocking wait described in
+|osc52-support|.
 
 ==============================================================================
 vim:tw=78:ts=8:fo=tcq2:ft=help:
index 66b5752e539f121c0d6208454f0143170cc1a416..0ae16376a5e799df696ff8a8391b35364fea7c44 100644 (file)
@@ -3,7 +3,7 @@ vim9script
 # Vim plugin for OSC52 clipboard support
 #
 # Maintainer:  The Vim Project <https://github.com/vim/vim>
-# Last Change: 2025 Dec 18
+# Last Change: 2026 Mar 01
 
 if !has("timers")
   finish
@@ -11,18 +11,25 @@ endif
 
 import autoload "../autoload/osc52.vim" as osc
 
-v:clipproviders["osc52"] = {
+var provider: dict<any> = {
   "available": osc.Available,
-  "paste": {
-    "*": osc.Paste,
-    "+": osc.Paste
-  },
   "copy": {
     "*": osc.Copy,
     "+": osc.Copy
   },
 }
 
+if !get(g:, 'osc52_disable_paste', 0)
+  provider->extend({
+    "paste": {
+      "*": osc.Paste,
+      "+": osc.Paste
+    }
+  })
+endif
+
+v:clipproviders["osc52"] = provider
+
 def SendDA1(): void
   if !has("gui_running") && !get(g:, 'osc52_force_avail', 0)
       && !get(g:, 'osc52_no_da1', 0)