From 4aa4ca31f18e6e0e9ca30591d63efab1f513054c Mon Sep 17 00:00:00 2001 From: Juan Luque Date: Wed, 9 Apr 2025 01:47:08 -0400 Subject: [PATCH] Fix `pasteinto` error when clipboard text has surrounding whitespace. (#262) `pasteinto` is called by `surroundFunc` which a string into whitespace delimited arguments. Surrounding whitespace in the link to be copied thus errors due to an unhandled number of arguments. The now fixed error can be recreated by using `yy` to yank a line and then using to paste the link over a word. Similarly, `yW` will reproduce the error if the link has a trailing whitespace. `pasteinto` will still error if the link contains internal whitespace, but this is more reasonable behavior. Fixing this will require tweaking the regex `surroundFunc` uses to split up arguments. --- main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.ts b/main.ts index 9aa7685..2a1471b 100644 --- a/main.ts +++ b/main.ts @@ -521,7 +521,7 @@ export default class VimrcPlugin extends Plugin { // Using the register for when this.yankToSystemClipboard == false surroundFunc( ['[', - '](' + vimObject.getRegisterController().getRegister('yank').keyBuffer + ")"]); + '](' + vimObject.getRegisterController().getRegister('yank').keyBuffer[0].trim() + ")"]); }) var editor = this.getActiveView().editor;