patch 9.1.1988: osc52 package can be further improved
Commit:
https://github.com/vim/vim/commit/b9e45e82ba1d81f86183be1e8b7f004682fc3533
Author: Foxe Chen <
chen...@gmail.com>
Date: Tue Dec 16 20:35:53 2025 +0100
patch 9.1.1988: osc52 package can be further improved
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...@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/runtime/pack/dist/opt/osc52/autoload/osc52.vim b/runtime/pack/dist/opt/osc52/autoload/osc52.vim
index bd664f17c..28c49accf 100644
--- a/runtime/pack/dist/opt/osc52/autoload/osc52.vim
+++ b/runtime/pack/dist/opt/osc52/autoload/osc52.vim
@@ -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
diff --git a/runtime/pack/dist/opt/osc52/plugin/osc52.vim b/runtime/pack/dist/opt/osc52/plugin/osc52.vim
index ddec41ed1..7801ef64e 100644
--- a/runtime/pack/dist/opt/osc52/plugin/osc52.vim
+++ b/runtime/pack/dist/opt/osc52/plugin/osc52.vim
@@ -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
}
diff --git a/src/testdir/test_plugin_osc52.vim b/src/testdir/test_plugin_osc52.vim
index fff40936a..f14d3b8c1 100644
--- a/src/testdir/test_plugin_osc52.vim
+++ b/src/testdir/test_plugin_osc52.vim
@@ -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!
diff --git a/src/version.c b/src/version.c
index a4d7a1bf7..64a2cc03b 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 */
+/**/
+ 1988,
/**/
1987,
/**/