From 0485f0c7ed8c1e7bcaad8e5466f0cb4b29a78289 Mon Sep 17 00:00:00 2001 From: Fabian Date: Sun, 16 May 2021 15:10:00 -0500 Subject: [PATCH] kitty @ get-text add an option to wrap long lines --- docs/changelog.rst | 3 +++ kitty/rc/get_text.py | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index b1267fb62..7ee126b97 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -56,6 +56,9 @@ To update |kitty|, :doc:`follow the instructions `. - ``kitty @ get-text`` add an option to also get the current cursor position and state as ANSI escape codes (:iss:`3625`) +- ``kitty @ get-text`` add an option to wrap long lines according to terminal + width + 0.20.3 [2021-05-06] ---------------------- diff --git a/kitty/rc/get_text.py b/kitty/rc/get_text.py index f075cdb41..e7c75050f 100644 --- a/kitty/rc/get_text.py +++ b/kitty/rc/get_text.py @@ -45,6 +45,11 @@ type=bool-set Add ANSI escape codes specifying the cursor position and style to the end of the text. +--add-wrap-markers +type=bool-set +Wrap long lines according to the width of the terminal. + + --self type=bool-set If specified get text from the window this command is run in, rather than the active window. @@ -52,7 +57,14 @@ If specified get text from the window this command is run in, rather than the ac argspec = '' def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType: - return {'match': opts.match, 'extent': opts.extent, 'ansi': opts.ansi, 'self': opts.self, 'cursor': opts.add_cursor} + return { + 'match': opts.match, + 'extent': opts.extent, + 'ansi': opts.ansi, + 'self': opts.self, + 'cursor': opts.add_cursor, + 'wrap_markers': opts.add_wrap_markers, + } def response_from_kitty(self, boss: Boss, window: Optional[Window], payload_get: PayloadGetType) -> ResponseType: window = self.windows_for_match_payload(boss, window, payload_get)[0] @@ -63,6 +75,7 @@ If specified get text from the window this command is run in, rather than the ac as_ansi=bool(payload_get('ansi')), add_history=payload_get('extent') == 'all', add_cursor=bool(payload_get('cursor')), + add_wrap_markers=bool(payload_get('wrap_markers')), ) return ans