aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdh19952016-08-15 16:03:46 +0800
committergdh19952016-08-15 16:03:47 +0800
commit7ccaf67e7be5b600948e57a2f2fa63ec7cb0fc5c (patch)
tree93966dbe817b81e09fbbd1fac2b2d89373ca4176
parentaa178b03ea1e4d12071751b81be9237428e5a97e (diff)
downloadvimium-7ccaf67e7be5b600948e57a2f2fa63ec7cb0fc5c.tar.bz2
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 ` `.
-rw-r--r--lib/clipboard.coffee4
1 files changed, 2 insertions, 2 deletions
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