summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKovid Goyal <kovid@kovidgoyal.net>2018-09-20 09:08:29 +0530
committerKovid Goyal <kovid@kovidgoyal.net>2018-09-20 09:08:29 +0530
commit3f0b52bef4439a1178077a7385c63b6e6cd088b6 (patch)
tree8c37d38487e290eee30fec3dc9c54f9ff148fe96
parent4a04f27fdeaffa15156cfe24a38bc728e860ad03 (diff)
Workaround for broken editors like nano that cannot handle newlines in pasted text
Fixes #994
-rw-r--r--docs/changelog.rst3
-rw-r--r--kitty/window.py4
2 files changed, 7 insertions, 0 deletions
diff --git a/docs/changelog.rst b/docs/changelog.rst
index a5a6c9c2..ff61a363 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -37,6 +37,9 @@ Changelog
- Fix drag-scrolling not working when the mouse leaves the window confines
(:iss:`917`)
+- Workaround for broken editors like nano that cannot handle newlines in pasted text
+ (:iss:`994`)
+
- Linux: Ensure that the python embedded in the kitty binary build uses
UTF-8 mode to process command-line arguments (:iss:`924`)
diff --git a/kitty/window.py b/kitty/window.py
index 92d2181d..3c96c2e5 100644
--- a/kitty/window.py
+++ b/kitty/window.py
@@ -478,6 +478,10 @@ class Window:
if len(text) == len(new_text):
break
text = new_text
+ else:
+ # Workaround for broken editors like nano that cannot handle
+ # newlines in pasted text see https://github.com/kovidgoyal/kitty/issues/994
+ text = b'\r'.join(text.splitlines())
self.screen.paste(text)
def copy_to_clipboard(self):