fix(clipboard): avoid using stale register width (#36178)

Fix #36177
Follow-up to #35038
This commit is contained in:
zeertzjq
2025-10-14 13:04:37 +08:00
committed by GitHub
parent 55bd54e526
commit 41199c45d6
2 changed files with 7 additions and 0 deletions

View File

@@ -146,6 +146,7 @@ bool get_clipboard(int name, yankreg_T **target, bool quiet)
reg->y_array = xcalloc((size_t)tv_list_len(lines), sizeof(String));
reg->y_size = (size_t)tv_list_len(lines);
reg->y_width = 0; // Will be updated by update_yankreg_width() below.
reg->additional_data = NULL;
reg->timestamp = 0;
// Timestamp is not saved for clipboard registers because clipboard registers

View File

@@ -563,6 +563,12 @@ describe('clipboard (with fake clipboard.vim)', function()
あいあいあいうえお
xxx xxx
xx xx]])
feed('G0<C-V>ky')
feed('P')
expect([[
あいあいあいうえお
xxxx xxx
xxx xx]])
end)
end)