kitty @ get-text add an option to wrap long lines

This commit is contained in:
Fabian 2021-05-16 15:10:00 -05:00
parent 2ade6c0739
commit 0485f0c7ed
2 changed files with 17 additions and 1 deletions

View File

@ -56,6 +56,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- ``kitty @ get-text`` add an option to also get the current cursor position - ``kitty @ get-text`` add an option to also get the current cursor position
and state as ANSI escape codes (:iss:`3625`) 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] 0.20.3 [2021-05-06]
---------------------- ----------------------

View File

@ -45,6 +45,11 @@ type=bool-set
Add ANSI escape codes specifying the cursor position and style to the end of the text. 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 --self
type=bool-set type=bool-set
If specified get text from the window this command is run in, rather than the active window. 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 = '' argspec = ''
def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType: 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: 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] 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')), as_ansi=bool(payload_get('ansi')),
add_history=payload_get('extent') == 'all', add_history=payload_get('extent') == 'all',
add_cursor=bool(payload_get('cursor')), add_cursor=bool(payload_get('cursor')),
add_wrap_markers=bool(payload_get('wrap_markers')),
) )
return ans return ans