[vim/vim] Clipboard/register interaction corrupts :reg output (only "+ and "/ remain) (Issue #18988)

8 views
Skip to first unread message

Satoru Kitaguchi

unread,
Dec 21, 2025, 2:51:23 AM (3 days ago) Dec 21
to vim/vim, Subscribed
satorunooshie created an issue (vim/vim#18988)

Steps to reproduce

I’m seeing unexpected behavior in the interaction between the system clipboard and registers.

With the system clipboard enabled, the output of :reg becomes corrupted.
Most registers no longer appear in :reg, leaving only "+ and "/, which also seem to be overwritten or contain unexpected data.

func Available()
    return v:true
endfunc

func Copy(reg, type, str)
    echom "Register: " .. a:reg
    echom "Register type: " .. a:type
    echom "Contents: " .. string(a:str)
endfunc

func Paste(reg)
    return ("b40", ["this", "is", "the", a:reg, "register!"])
endfunc

let v:clipproviders["test"] = {
    \ "available": function("Available"),
    \ "copy": {
    \     "+": function("Copy"),
    \     "*": function("Copy")
    \	},
    \ "paste": {
    \     "+": function("Paste"),
    \     "*": function("Paste")
    \	}
    \ }
set clipmethod^=test
set clipboard=unnamed,unnamedplus

Then register contents look incorrect

:reg
Type Name Content
  l  "+   let g:loaded_netrw            = 1^Jfunc Available()^J    return v:true^Jendfunc^J^Jfunc Copy(reg, type, str)^J    echom "Register: " .. a:reg^J    echom "Register type: " .. a:type^J    echom "Contents:
  l  "+   let g:loaded_netrw            = 1^Jfunc Available()^J    return v:true^Jendfunc^J^Jfunc Copy(reg, type, str)^J    echom "Register: " .. a:reg^J    echom "Register type: " .. a:type^J    echom "Contents:
  l  "+   set clipboard=unnamed,unnamedplus^J
  l  "+   ^J
  l  "+   vim9script^J
  l  "+   ^J
  l  "+   ^J
  l  "+       echom 'PB_Available called'^J
  l  "+       echom 'PB_Paste called for register: ' .. reg^J
  l  "+       echom 'PB_Copy called for register: ' .. reg .. ' with regtype: ' .. regtype^J
  l  "+             type: string^J          description: A description of the fave.^J          example: "A brief description of the fave."^J
  c  "+   wwi: struct{}^[la^M^[l
  c  "+   ^C^C
  c  "+   ja   ^[
  c  "+   set
  b  "+   this^Jis^Jthe^J*^Jregister!
  b  "+   this^Jis^Jthe^J+^Jregister!
  c  "%   fuga.vim
  c  "/   pb

Expected behaviour

:reg
Type Name Content
  l  ""   let g:loaded_netrw            = 1^Jfunc Available()^J    return v:true^Jendfunc^J^Jfunc Copy(reg, type, str)^J    echom "Register: " .. a:reg^J    echom "Register type: " .. a:type^J    echom "Contents:
  l  "0   let g:loaded_netrw            = 1^Jfunc Available()^J    return v:true^Jendfunc^J^Jfunc Copy(reg, type, str)^J    echom "Register: " .. a:reg^J    echom "Register type: " .. a:type^J    echom "Contents:
  l  "1   set clipboard=unnamed,unnamedplus^J
  l  "2   ^J
  l  "3   vim9script^J
  l  "4   ^J
  l  "5   ^J
  l  "6       echom 'PB_Available called'^J
  l  "7       echom 'PB_Paste called for register: ' .. reg^J
  l  "8       echom 'PB_Copy called for register: ' .. reg .. ' with regtype: ' .. regtype^J
  l  "9             type: string^J          description: A description of the fave.^J          example: "A brief description of the fave."^J
  c  "a   wwi: struct{}^[la^M^[l
  c  "j   ^C^C
  c  "q   ja   ^[
  c  "-   set
  c  "*   a820a4540d2186208ba11f99a0cea878cb443e6a
  c  "/   pb

Version of Vim

a820a45

Environment

OS: macOS 15.6.1(24G90)
$TERM: xterm-256color
$SHELL: /bin/zsh

Logs and stack traces


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18988@github.com>

Satoru Kitaguchi

unread,
Dec 21, 2025, 2:51:41 AM (3 days ago) Dec 21
to vim/vim, Subscribed
satorunooshie left a comment (vim/vim#18988)

#18952 (comment)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18988/3678563310@github.com>

Christian Brabandt

unread,
3:36 PM (5 hours ago) 3:36 PM
to vim/vim, Subscribed

Closed #18988 as completed via 11c3c62.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/18988/issue_event/21732281923@github.com>

Reply all
Reply to author
Forward
0 new messages