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>
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
# 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
}
autocmd VimEnter * {
if !has("gui_running") && !get(g:, 'osc52_force_avail', 0)
+ && !get(g:, 'osc52_no_da1', 0)
echoraw("\<Esc>[c")
endif
}
" 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
CheckScreendump
let lines =<< trim END
+ let g:osc52_no_da1 = 1
packadd osc52
set clipmethod=osc52
redraw!
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1988,
/**/
1987,
/**/