]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1988: osc52 package can be further improved v9.1.1988
authorFoxe Chen <chen.foxe@gmail.com>
Tue, 16 Dec 2025 19:35:53 +0000 (20:35 +0100)
committerChristian Brabandt <cb@256bit.org>
Tue, 16 Dec 2025 19:35:53 +0000 (20:35 +0100)
Problem:  osc52 package can be further improved (after v9.1.1984).
Solution: Improve plugin, update test and check for clipboard_provider
          feature (Foxe Chen).

closes: #18935

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/pack/dist/opt/osc52/autoload/osc52.vim
runtime/pack/dist/opt/osc52/plugin/osc52.vim
src/testdir/test_plugin_osc52.vim
src/version.c

index bd664f17c8ad609ee212dc1172bb2f84b66ebfff..28c49accf98d955fcb4a45ce78780d076ef48b41 100644 (file)
@@ -67,18 +67,23 @@ export def Paste(reg: string): tuple<string, list<string>>
   endif
 
   # Extract the base64 stuff
-  var stuff: string = matchstr(v:termosc, '52;.\+;\zs[A-Za-z0-9+/=]\+')
-  var decoded: blob
+  var stuff: string = matchstr(v:termosc, '52;.*;\zs[A-Za-z0-9+/=]*')
+
+  if len(stuff) == 0
+    return ("c", [])
+  endif
+
+  var ret: list<string>
 
   # "stuff" may be an invalid base64 string, so catch any errors
   try
-    decoded = base64_decode(stuff)
-  catch /:E475/
-    decoded = null_blob
+    ret = blob2str(base64_decode(stuff))
+  catch /E\(475\|1515\)/
     echo "Invalid OSC 52 response received"
+    return ("c", [""])
   endtry
 
-  return ("", blob2str(decoded))
+  return ("", ret)
 enddef
 
 export def Copy(reg: string, type: string, lines: list<string>): void
index ddec41ed17cc94e689ebeb5fba0ecf6d1da33aa4..7801ef64e5ce3d5a4abbfc9ff4d7508997672b84 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 October 14
+# Last Change: 2025 Dec 16
 
 if !has("timers")
   finish
@@ -37,6 +37,7 @@ augroup VimOSC52Plugin
   }
   autocmd VimEnter * {
     if !has("gui_running") && !get(g:, 'osc52_force_avail', 0)
+        && !get(g:, 'osc52_no_da1', 0)
       echoraw("\<Esc>[c")
     endif
   }
index fff40936ad4276c45c4ebd7198069058d7cc0e54..f14d3b8c16cb10ed3cca7b016f2224b427ca500b 100644 (file)
@@ -1,14 +1,14 @@
 " Test for the OSC 52 plugin
 
+CheckFeature clipboard_provider
 CheckRunVimInTerminal
-" Does not run on BSD CI test runner
-CheckNotBSD
 
 source util/screendump.vim
 
 " Check if plugin correctly detects OSC 52 support if possible
 func Test_osc52_detect()
   let lines =<< trim END
+    let g:osc52_no_da1 = 1
     packadd osc52
     set clipmethod=osc52
   END
@@ -46,6 +46,7 @@ func Test_osc52_paste()
   CheckScreendump
 
   let lines =<< trim END
+    let g:osc52_no_da1 = 1
     packadd osc52
     set clipmethod=osc52
     redraw!
index a4d7a1bf749d506377130f31151b55626f718868..64a2cc03bd4653c16066d7dfe62c459b206cefad 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1988,
 /**/
     1987,
 /**/