From 3f0b52bef4439a1178077a7385c63b6e6cd088b6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 20 Sep 2018 09:08:29 +0530 Subject: Workaround for broken editors like nano that cannot handle newlines in pasted text Fixes #994 --- docs/changelog.rst | 3 +++ kitty/window.py | 4 ++++ 2 files changed, 7 insertions(+) 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): -- cgit v1.2.3