mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-09 13:45:26 +02:00
add verification for parsing shell_integration
This commit is contained in:
@@ -2656,7 +2656,7 @@ with the mouse or the :doc:`hints kitten </kittens/hints>`. The special value of
|
||||
'''
|
||||
)
|
||||
|
||||
opt('shell_integration', 'enabled',
|
||||
opt('shell_integration', 'enabled', option_type='shell_integration',
|
||||
long_text='''
|
||||
Enable shell integration on supported shells. This enables features such as
|
||||
jumping to previous prompts, browsing the output of the previous command in a
|
||||
|
||||
6
kitty/options/parse.py
generated
6
kitty/options/parse.py
generated
@@ -12,8 +12,8 @@ from kitty.options.utils import (
|
||||
deprecated_hide_window_decorations_aliases, deprecated_macos_show_window_title_in_menubar_alias,
|
||||
deprecated_send_text, disable_ligatures, edge_width, env, font_features, hide_window_decorations,
|
||||
macos_option_as_alt, macos_titlebar_color, optional_edge_width, parse_map, parse_mouse_map,
|
||||
resize_draw_strategy, scrollback_lines, scrollback_pager_history_size, symbol_map,
|
||||
tab_activity_symbol, tab_bar_edge, tab_bar_margin_height, tab_bar_min_tabs, tab_fade,
|
||||
resize_draw_strategy, scrollback_lines, scrollback_pager_history_size, shell_integration,
|
||||
symbol_map, tab_activity_symbol, tab_bar_edge, tab_bar_margin_height, tab_bar_min_tabs, tab_fade,
|
||||
tab_font_style, tab_separator, tab_title_template, to_cursor_shape, to_font_size, to_layout_names,
|
||||
to_modifiers, url_prefixes, url_style, visual_window_select_characters, watcher,
|
||||
window_border_width, window_size
|
||||
@@ -1147,7 +1147,7 @@ class Parser:
|
||||
ans['shell'] = str(val)
|
||||
|
||||
def shell_integration(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
ans['shell_integration'] = str(val)
|
||||
ans['shell_integration'] = shell_integration(val)
|
||||
|
||||
def single_window_margin_width(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||
ans['single_window_margin_width'] = optional_edge_width(val)
|
||||
|
||||
@@ -766,6 +766,15 @@ def watcher(val: str, current_val: Container[str]) -> Iterable[Tuple[str, str]]:
|
||||
yield val, val
|
||||
|
||||
|
||||
def shell_integration(x: str) -> str:
|
||||
s = {'enabled', 'disabled', 'no-rc', 'no-cursor', 'no-title', 'no-prompt-mark', 'no-complete'}
|
||||
q = set(x.split())
|
||||
if not q.issubset(s):
|
||||
log_error(f'Invalid shell integration options: {q - s}, ignoring')
|
||||
return ' '.join(q & s)
|
||||
return x
|
||||
|
||||
|
||||
def action_alias(val: str) -> Iterable[Tuple[str, str]]:
|
||||
parts = val.split(maxsplit=1)
|
||||
if len(parts) > 1:
|
||||
|
||||
Reference in New Issue
Block a user