hints kitten: Make the --program option work with --linenum-action=self
Fixes #3931
This commit is contained in:
parent
437ba69049
commit
8cfb1efb01
@ -44,6 +44,10 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||||||
- When dragging word or line selections, ensure the initially selected item is
|
- When dragging word or line selections, ensure the initially selected item is
|
||||||
never deselected. This matches behavior in most other programs (:iss:`3930`)
|
never deselected. This matches behavior in most other programs (:iss:`3930`)
|
||||||
|
|
||||||
|
- hints kitten: Make copy/paste with the :option:`kitty +kitten hints
|
||||||
|
--program` option work when using the ``self``
|
||||||
|
:option:`kitty +kitten hints --linenum-action` (:iss:`3931`)
|
||||||
|
|
||||||
|
|
||||||
0.22.2 [2021-08-02]
|
0.22.2 [2021-08-02]
|
||||||
----------------------
|
----------------------
|
||||||
|
|||||||
@ -553,10 +553,12 @@ choices=self,window,tab,os_window,background
|
|||||||
Where to perform the action on matched errors. :code:`self` means the current
|
Where to perform the action on matched errors. :code:`self` means the current
|
||||||
window, :code:`window` a new kitty window, :code:`tab` a new tab,
|
window, :code:`window` a new kitty window, :code:`tab` a new tab,
|
||||||
:code:`os_window` a new OS window and :code:`background` run in the background.
|
:code:`os_window` a new OS window and :code:`background` run in the background.
|
||||||
The action to perform on the matched errors. The actual action is whatever
|
The actual action is whatever arguments are provided to the kitten, for
|
||||||
arguments are provided to the kitten, for example: :code:`kitty + kitten hints
|
example:
|
||||||
--type=linenum --linenum-action=tab vim +{line} {path}` will open the matched
|
:code:`kitty + kitten hints --type=linenum --linenum-action=tab vim +{line} {path}`
|
||||||
path at the matched line number in vim in a new kitty tab.
|
will open the matched path at the matched line number in vim in
|
||||||
|
a new kitty tab. Note that only when using :code:`self` are the special values for
|
||||||
|
:option:`kitty +kitten hints --program` to copy/paste the text respected.
|
||||||
|
|
||||||
|
|
||||||
--url-prefixes
|
--url-prefixes
|
||||||
@ -705,6 +707,16 @@ def linenum_handle_result(args: List[str], data: Dict[str, Any], target_window_i
|
|||||||
|
|
||||||
if action == 'self':
|
if action == 'self':
|
||||||
if w is not None:
|
if w is not None:
|
||||||
|
is_copy_action = cmd[0] in ('-', '@', '*')
|
||||||
|
if is_copy_action:
|
||||||
|
text = ' '.join(cmd[1:])
|
||||||
|
if cmd[0] == '-':
|
||||||
|
w.paste_bytes(text)
|
||||||
|
elif cmd[0] == '@':
|
||||||
|
set_clipboard_string(text)
|
||||||
|
elif cmd[0] == '*':
|
||||||
|
set_primary_selection(text)
|
||||||
|
else:
|
||||||
import shlex
|
import shlex
|
||||||
text = ' '.join(shlex.quote(arg) for arg in cmd)
|
text = ' '.join(shlex.quote(arg) for arg in cmd)
|
||||||
w.paste_bytes(text + '\r')
|
w.paste_bytes(text + '\r')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user