From 7ccaf67e7be5b600948e57a2f2fa63ec7cb0fc5c Mon Sep 17 00:00:00 2001 From: gdh1995 Date: Mon, 15 Aug 2016 16:03:46 +0800 Subject: replace \xA0 on copying and pasting The char `\xA0` may be contained in a string if we use `y` to yank a line which contains ` `. --- lib/clipboard.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/clipboard.coffee b/lib/clipboard.coffee index af143dd9..d015cdad 100644 --- a/lib/clipboard.coffee +++ b/lib/clipboard.coffee @@ -8,7 +8,7 @@ Clipboard = # http://groups.google.com/group/chromium-extensions/browse_thread/thread/49027e7f3b04f68/f6ab2457dee5bf55 copy: ({data}) -> textArea = @_createTextArea() - textArea.value = data + textArea.value = data.replace /\xa0/g, " " document.body.appendChild(textArea) textArea.select() @@ -22,7 +22,7 @@ Clipboard = document.execCommand("Paste") value = textArea.value document.body.removeChild(textArea) - value + value.replace /\xa0/g, " " root = exports ? window -- cgit v1.2.3