Use @ rather than # for named buffers prefix char

Matches existing use of @ for clipboard. Also @ doesnt need to be quoted
in most shells.
This commit is contained in:
Kovid Goyal 2023-03-01 19:54:03 +05:30
parent 8ad39332c9
commit 81f8ed6b45
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -545,8 +545,8 @@ for the operating system. Various special values are supported:
:code:`*` :code:`*`
copy the match to the primary selection (on systems that support primary selections) copy the match to the primary selection (on systems that support primary selections)
:code:`#NAME` :code:`@NAME`
copy the match to the specified buffer, e.g. :code:`#a` copy the match to the specified buffer, e.g. :code:`@a`
:code:`default` :code:`default`
run the default open program. run the default open program.
@ -749,7 +749,7 @@ 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 ('-', '@', '*') or cmd[0].startswith('#') is_copy_action = cmd[0] in ('-', '@', '*')
if is_copy_action: if is_copy_action:
text = ' '.join(cmd[1:]) text = ' '.join(cmd[1:])
if cmd[0] == '-': if cmd[0] == '-':
@ -758,8 +758,8 @@ def linenum_handle_result(args: List[str], data: Dict[str, Any], target_window_i
set_clipboard_string(text) set_clipboard_string(text)
elif cmd[0] == '*': elif cmd[0] == '*':
set_primary_selection(text) set_primary_selection(text)
elif cmd[0].startswith('#'): elif cmd[0].startswith('@'):
boss.set_clipboard_buffer(cmd[0].lstrip('#'), text) boss.set_clipboard_buffer(cmd[0][1:], text)
else: else:
import shlex import shlex
text = ' '.join(shlex.quote(arg) for arg in cmd) text = ' '.join(shlex.quote(arg) for arg in cmd)
@ -816,12 +816,13 @@ def handle_result(args: List[str], data: Dict[str, Any], target_window_id: int,
w = boss.window_id_map.get(target_window_id) w = boss.window_id_map.get(target_window_id)
if w is not None: if w is not None:
w.paste_text(joined_text()) w.paste_text(joined_text())
elif program == '@':
set_clipboard_string(joined_text())
elif program == '*': elif program == '*':
set_primary_selection(joined_text()) set_primary_selection(joined_text())
elif program.startswith('#'): elif program.startswith('@'):
boss.set_clipboard_buffer(program.lstrip('#'), joined_text()) if program == '@':
set_clipboard_string(joined_text())
else:
boss.set_clipboard_buffer(program[1:], joined_text())
else: else:
from kitty.conf.utils import to_cmdline from kitty.conf.utils import to_cmdline
cwd = data['cwd'] cwd = data['cwd']