kitty @ get-text: Add a n option to clear the current selection after getting text

See #4600
This commit is contained in:
Kovid Goyal 2022-01-31 08:22:05 +05:30
parent c4953504ba
commit 2c0269930f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -22,6 +22,7 @@ class GetText(RemoteCommand):
ansi: Boolean, if True send ANSI formatting codes
cursor: Boolean, if True send cursor position/style as ANSI codes
wrap_markers: Boolean, if True add wrap markers to output
clear_selection: Boolean, if True clear the selection in the matched window
self: Boolean, if True use window command was run in
'''
@ -60,6 +61,10 @@ screen edges).
--self
type=bool-set
If specified get text from the window this command is run in, rather than the active window.
--clear-selection
Clear the selection in the matched window, if any
'''
argspec = ''
@ -71,6 +76,7 @@ If specified get text from the window this command is run in, rather than the ac
'self': opts.self,
'cursor': opts.add_cursor,
'wrap_markers': opts.add_wrap_markers,
'clear_selection': opts.clear_selection,
}
def response_from_kitty(self, boss: Boss, window: Optional[Window], payload_get: PayloadGetType) -> ResponseType:
@ -103,6 +109,8 @@ If specified get text from the window this command is run in, rather than the ac
add_cursor=bool(payload_get('cursor')),
add_wrap_markers=bool(payload_get('wrap_markers')),
)
if payload_get('clear_selection'):
window.clear_selection()
return ans