Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

action_alias kitten with space in filepath fails to parse #8178

Closed
mikesmithgh opened this issue Dec 30, 2024 · 0 comments
Closed

action_alias kitten with space in filepath fails to parse #8178

mikesmithgh opened this issue Dec 30, 2024 · 0 comments
Labels

Comments

@mikesmithgh
Copy link
Contributor

Describe the bug
When an action_alias for a kitten is using a filepath and that path contains a whitespace, it fails to parse.

For example,

action_alias kitty_scrollback_nvim kitten '~/Library/Application Support/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py'

This was found during in a discussion for kitty-scrollback.nvim mikesmithgh/kitty-scrollback.nvim#293. The workaround is to symlink the plugin path to ~/.config/kitty/kitty-scrollback.nvim

To Reproduce
Steps to reproduce the behavior:

  1. Open kitty.conf
  2. Add line
action_alias kitty_scrollback_nvim kitten '~/Library/Application Support/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py'
map kitty_mod+h kitty_scrollback_nvim 
  1. Save and reload config
  2. Press ctrl+shift+h

Screenshots
parse error

Environment details

kitty 0.38.1 (fa6ae712a3) created by Kovid Goyal
Darwin Mac.fios-router.home 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:11 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6020 arm64
ProductName:		macOS ProductVersion:		15.1.1 BuildVersion:		24B91
OpenGL: '4.1 Metal - 89.3' Detected version: 4.1
Frozen: True
Fonts:
  medium: MonoLisaVariable-Regular: /Users/mike/Library/Fonts/MonoLisaVariableNormal.ttf
          Features: ('calt', 'liga', 'zero', 'ss04', 'ss06', 'ss07', 'ss08', 'ss10', 'ss11', 'ss12', 'ss13', 'ss15', 'ss16')
    bold: MonoLisaVariableRegular-SemiBold: /Users/mike/Library/Fonts/MonoLisaVariableNormal.ttf
          Features: ('calt', 'liga', 'zero', 'ss04', 'ss06', 'ss07', 'ss08', 'ss10', 'ss11', 'ss12', 'ss13', 'ss15', 'ss16')
  italic: MonoLisaVariable-Italic: /Users/mike/Library/Fonts/MonoLisaVariableItalic.ttf
          Features: ('calt', 'liga', 'zero', 'ss04', 'ss06', 'ss07', 'ss08', 'ss10', 'ss11', 'ss12', 'ss13', 'ss15', 'ss16')
      bi: MonoLisaVariableItalic-SemiBold: /Users/mike/Library/Fonts/MonoLisaVariableItalic.ttf
          Features: ('calt', 'liga', 'zero', 'ss04', 'ss06', 'ss07', 'ss08', 'ss10', 'ss11', 'ss12', 'ss13', 'ss15', 'ss16')
Paths:
  kitty: /Applications/kitty.app/Contents/MacOS/kitty
  base dir: /Applications/kitty.app/Contents/Resources/kitty
  extensions dir: /Applications/kitty.app/Contents/Resources/Python/lib/kitty-extensions
  system shell: /opt/homebrew/bin/bash
System color scheme: dark. Applied color theme type: none
Loaded config files:
  /Users/mike/.config/kitty/kitty.conf
Loaded config overrides:
  env PATH=/opt/homebrew/opt/sdkman-cli/libexec/candidates/kotlin/current/bin:/opt/homebrew/opt/sdkman-cli/libexec/candidates/java/current/bin:/opt/homebrew/opt/sdkman-cli/libexec/candidates/gradle/current/bin:/Users/mike/bin:/Users/mike/.local/bin:/opt/homebrew/bin:/Users/mike/go/bin:/Users/mike/.config/pyenv/bin:/Users/mike/.config/pyenv/bin:/Users/mike/gitrepos/neovim/build/bin:/Users/mike/.cargo/bin:/opt/homebrew/opt/libpq/bin:/Users/mike/Library/Application Support/Coursier/bin:/Users/mike/.config/pyenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/go/bin::/opt/homebrew/opt/fzf/bin
  env PYENV_SHELL=bash
  env PYENV_ROOT=/Users/mike/.config/pyenv

Config options different from defaults:
active_tab_font_style           (False, False)
allow_remote_control            socket-only
cursor_blink_interval           (0.0, kitty.options.utils.EasingFunction(), kitty.options.utils.EasingFunction())
cursor_stop_blinking_after      0
cursor_trail                    3
cursor_trail_decay              (0.2, 0.3)
cursor_trail_start_threshold    3
editor                          /Users/mike/bin/nvim
enable_audio_bell               False
enabled_layouts                 ['vertical', 'horizontal', 'fat', 'grid', 'splits', 'stack', 'tall']
env:
{'EDITOR': 'nvim',
 'PATH': '/opt/homebrew/opt/sdkman-cli/libexec/candidates/kotlin/current/bin:/opt/homebrew/opt/sdkman-cli/libexec/candidates/java/current/bin:/opt/homebrew/opt/sdkman-cli/libexec/candidates/gradle/current/bin:/Users/mike/bin:/Users/mike/.local/bin:/opt/homebrew/bin:/Users/mike/go/bin:/Users/mike/.config/pyenv/bin:/Users/mike/.config/pyenv/bin:/Users/mike/gitrepos/neovim/build/bin:/Users/mike/.cargo/bin:/opt/homebrew/opt/libpq/bin:/Users/mike/Library/Application '
         'Support/Coursier/bin:/Users/mike/.config/pyenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/go/bin::/opt/homebrew/opt/fzf/bin',
 'PYENV_ROOT': '/Users/mike/.config/pyenv',
 'PYENV_SHELL': 'bash',
 'VIMRUNTIME': '/Users/mike/gitrepos/neovim/runtime',
 'VISUAL': 'nvim'}
font_family                     MonoLisa Variable
font_features:
{'MonoLisaVariable-Italic': ('calt',
                             'liga',
                             'zero',
                             'ss04',
                             'ss06',
                             'ss07',
                             'ss08',
                             'ss10',
                             'ss11',
                             'ss12',
                             'ss13',
                             'ss15',
                             'ss16'),
 'MonoLisaVariable-Regular': ('calt',
                              'liga',
                              'zero',
                              'ss04',
                              'ss06',
                              'ss07',
                              'ss08',
                              'ss10',
                              'ss11',
                              'ss12',
                              'ss13',
                              'ss15',
                              'ss16'),
 'MonoLisaVariableItalic-Black': ('calt',
                                  'liga',
                                  'zero',
                                  'ss04',
                                  'ss06',
                                  'ss07',
                                  'ss08',
                                  'ss10',
                                  'ss11',
                                  'ss12',
                                  'ss13',
                                  'ss15',
                                  'ss16'),
 'MonoLisaVariableItalic-Bold': ('calt',
                                 'liga',
                                 'zero',
                                 'ss04',
                                 'ss06',
                                 'ss07',
                                 'ss08',
                                 'ss10',
                                 'ss11',
                                 'ss12',
                                 'ss13',
                                 'ss15',
                                 'ss16'),
 'MonoLisaVariableItalic-ExtraBold': ('calt',
                                      'liga',
                                      'zero',
                                      'ss04',
                                      'ss06',
                                      'ss07',
                                      'ss08',
                                      'ss10',
                                      'ss11',
                                      'ss12',
                                      'ss13',
                                      'ss15',
                                      'ss16'),
 'MonoLisaVariableItalic-ExtraLight': ('calt',
                                       'liga',
                                       'zero',
                                       'ss04',
                                       'ss06',
                                       'ss07',
                                       'ss08',
                                       'ss10',
                                       'ss11',
                                       'ss12',
                                       'ss13',
                                       'ss15',
                                       'ss16'),
 'MonoLisaVariableItalic-Light': ('calt',
                                  'liga',
                                  'zero',
                                  'ss04',
                                  'ss06',
                                  'ss07',
                                  'ss08',
                                  'ss10',
                                  'ss11',
                                  'ss12',
                                  'ss13',
                                  'ss15',
                                  'ss16'),
 'MonoLisaVariableItalic-Medium': ('calt',
                                   'liga',
                                   'zero',
                                   'ss04',
                                   'ss06',
                                   'ss07',
                                   'ss08',
                                   'ss10',
                                   'ss11',
                                   'ss12',
                                   'ss13',
                                   'ss15',
                                   'ss16'),
 'MonoLisaVariableItalic-SemiBold': ('calt',
                                     'liga',
                                     'zero',
                                     'ss04',
                                     'ss06',
                                     'ss07',
                                     'ss08',
                                     'ss10',
                                     'ss11',
                                     'ss12',
                                     'ss13',
                                     'ss15',
                                     'ss16'),
 'MonoLisaVariableItalic-Thin': ('calt',
                                 'liga',
                                 'zero',
                                 'ss04',
                                 'ss06',
                                 'ss07',
                                 'ss08',
                                 'ss10',
                                 'ss11',
                                 'ss12',
                                 'ss13',
                                 'ss15',
                                 'ss16'),
 'MonoLisaVariableRegular-Black': ('calt',
                                   'liga',
                                   'zero',
                                   'ss04',
                                   'ss06',
                                   'ss07',
                                   'ss08',
                                   'ss10',
                                   'ss11',
                                   'ss12',
                                   'ss13',
                                   'ss15',
                                   'ss16'),
 'MonoLisaVariableRegular-Bold': ('calt',
                                  'liga',
                                  'zero',
                                  'ss04',
                                  'ss06',
                                  'ss07',
                                  'ss08',
                                  'ss10',
                                  'ss11',
                                  'ss12',
                                  'ss13',
                                  'ss15',
                                  'ss16'),
 'MonoLisaVariableRegular-ExtraBold': ('calt',
                                       'liga',
                                       'zero',
                                       'ss04',
                                       'ss06',
                                       'ss07',
                                       'ss08',
                                       'ss10',
                                       'ss11',
                                       'ss12',
                                       'ss13',
                                       'ss15',
                                       'ss16'),
 'MonoLisaVariableRegular-ExtraLight': ('calt',
                                        'liga',
                                        'zero',
                                        'ss04',
                                        'ss06',
                                        'ss07',
                                        'ss08',
                                        'ss10',
                                        'ss11',
                                        'ss12',
                                        'ss13',
                                        'ss15',
                                        'ss16'),
 'MonoLisaVariableRegular-Light': ('calt',
                                   'liga',
                                   'zero',
                                   'ss04',
                                   'ss06',
                                   'ss07',
                                   'ss08',
                                   'ss10',
                                   'ss11',
                                   'ss12',
                                   'ss13',
                                   'ss15',
                                   'ss16'),
 'MonoLisaVariableRegular-Medium': ('calt',
                                    'liga',
                                    'zero',
                                    'ss04',
                                    'ss06',
                                    'ss07',
                                    'ss08',
                                    'ss10',
                                    'ss11',
                                    'ss12',
                                    'ss13',
                                    'ss15',
                                    'ss16'),
 'MonoLisaVariableRegular-SemiBold': ('calt',
                                      'liga',
                                      'zero',
                                      'ss04',
                                      'ss06',
                                      'ss07',
                                      'ss08',
                                      'ss10',
                                      'ss11',
                                      'ss12',
                                      'ss13',
                                      'ss15',
                                      'ss16'),
 'MonoLisaVariableRegular-Thin': ('calt',
                                  'liga',
                                  'zero',
                                  'ss04',
                                  'ss06',
                                  'ss07',
                                  'ss08',
                                  'ss10',
                                  'ss11',
                                  'ss12',
                                  'ss13',
                                  'ss15',
                                  'ss16')}
font_size                       18.0
hide_window_decorations         2
initial_window_height           (1200, 'px')
initial_window_width            (1280, 'px')
listen_on                       unix:/tmp/kitty
macos_option_as_alt             3
menu_map:
{('global', '\U000f011b  \uf004  \ue6ae', 'kitty_scrollback_nvim'): 'kitty_scrollback_nvim',
 ('global', '\U000f011b  \uf004  \ue6ae', 'kitty_scrollback_nvim --config ksb_builtin_last_cmd_output'): 'kitty_scrollback_nvim '
                                                                                                         '--config '
                                                                                                         'ksb_builtin_last_cmd_output'}
narrow_symbols:
{(58923, 58923): 1,
 (59054, 59054): 1,
 (59333, 59333): 1,
 (60115, 60115): 1,
 (61489, 61489): 1,
 (62081, 62081): 1,
 (62309, 62309): 1,
 (62762, 62762): 1}
remember_window_size            False
scrollback_fill_enlarged_window True
scrollback_pager                ['/opt/homebrew/bin/less', '--ignore-case', '--status-column', '--no-init', '--raw-control-chars', '--chop-long-lines', '+INPUT_LINE_NUMBER', '--use-color', '--color=P0.7$', '--prompt=?f \uea7b %f : \U000f011b (kitty) .?m(%T %i of %m) .?lt\ue0a1 %lt-%lb?L/%L. .\U000f1a05 %bB?s/%s. ?e(END) :?pB%pB\\%..%t \uf11c  v=>pipe e=>edit \ue6ae %E $']
scrollback_pager_history_size   2097152
shell                           fish
shell_integration               frozenset({'no-cursor', 'enabled'})
symbol_map:
	U+23fb - U+23fe → FiraCode Nerd Font
	U+2665 - U+2665 → FiraCode Nerd Font
	U+26a1 - U+26a1 → FiraCode Nerd Font
	U+2b58 - U+2b58 → FiraCode Nerd Font
	U+e000 - U+f8ff → FiraCode Nerd Font
tab_bar_align                   center
window_margin_width             FloatEdges(left=2.0, top=2.0, right=2.0, bottom=2.0)
window_padding_width            FloatEdges(left=4.0, top=8.0, right=4.0, bottom=8.0)
Changed mouse actions:
	ctrl+shift+right press ungrabbed →  combine : mouse_select_command_output : kitty_scrollback_nvim --config ksb_builtin_last_visited_cmd_output
Added shortcuts:
	ctrl+w > j →  [--when-focus-on=var:in_editor]no-op, toggle_layout stack, kitten pass_keys.py neighboring_window right  'ctrl+w>l', kitten pass_keys.py neighboring_window left   'ctrl+w>h', kitten pass_keys.py neighboring_window top    'ctrl+w>k', kitten pass_keys.py neighboring_window bottom 'ctrl+w>j'
	shift+down →  move_window down
	shift+left →  move_window left
	shift+right →  move_window right
	shift+up →  move_window up
Changed shortcuts:
	cmd+enter →  launch --cwd=current
	cmd+k →  clear_terminal_and_scrollback
	ctrl+cmd+, →  reload_config
	kitty_mod+enter →  launch --cwd=current
	kitty_mod+f →  kitty_scrollback_nvim --config search
	kitty_mod+g →  kitty_scrollback_nvim --config ksb_builtin_last_cmd_output
	kitty_mod+h →  kitty_scrollback_nvim
	opt+cmd+r →  reset_terminal
	shift+cmd+/ →  open_kitty_website
Colors:
	active_border_color             #53654e   
	active_tab_background           #32302f   
	active_tab_foreground           #a0a0a0   
	background                      #070707   
	bell_border_color               #d3869b   
	color0                          #070707   
	color1                          #ff6961   
	color10                         #53654e   
	color11                         #d6991d   
	color12                         #458588   
	color13                         #b16286   
	color14                         #92bbdf   
	color15                         #b7a7b7   
	color2                          #8faa80   
	color3                          #dbbc5f   
	color4                          #83a598   
	color5                          #d3869b   
	color6                          #9dbad4   
	color7                          #c7c7c7   
	color8                          #968c81   
	color9                          #af3a03   
	cursor                          #c7c7c7   
	cursor_text_color               #504a45   
	foreground                      #c7c7c7   
	inactive_border_color           #1a1a1a   
	inactive_tab_background         #1a1a1a   
	inactive_tab_foreground         #504945   
	macos_titlebar_color            #070707   
	mark1_background                #1a1a1a   
	mark1_foreground                #83a598   
	mark2_background                #1a1a1a   
	mark2_foreground                #dbbc5f   
	mark3_background                #1a1a1a   
	mark3_foreground                #ff6961   
	selection_background            #878787   
	selection_foreground            #3c3836   
	tab_bar_background              #070707   
	tab_bar_margin_color            #070707   
	url_color                       #9dbad4   
	visual_bell_color               #32302f   
	wayland_titlebar_color          #070707   

Important environment variables seen by the kitty process:
	PATH                                /Applications/kitty.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin
	LANG                                en_US.UTF-8
	SHELL                               /opt/homebrew/bin/bash
	USER                                mike

Additional context

I noticed the error is occurring here

def kitten_parse(func: str, rest: str) -> FuncArgsType:
during the string split.

I played around a bit and used shlex_split to get it to work locally. But then started seeing test failures, so wasn't sure if this was a good approach.

@func_with_args('run_kitten', 'run_simple_kitten', 'kitten')
def kitten_parse(func: str, rest: str) -> FuncArgsType:
    parts = list(shlex_split(rest))
    if func != 'kitten':
        del parts[0]
        func = 'kitten'
    args = ' '.join(parts[1:])
    cmd = parts[0]
    return func, [cmd] + (to_cmdline(args[1]) if len(args) > 1 else [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant