kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.13k stars 971 forks source link

`show_last_command_output` not working when spawning new shell #7247

Closed daaser closed 6 months ago

daaser commented 6 months ago

Describe the bug When spawning a new zsh process over top of my current shell, the show_last_command_output command operates in the same fashion as --stdin-source=@screen_scrollback, rather than showing the actual last command run.

To Reproduce

  1. Spawn new shell (via zsh in my case but bash was also tested)
  2. Create a few new lines
  3. ctrl+shift+g

Screenshots 21-59-l8xhn-84y6t

Environment details

kitty 0.33.0 (04f8cb6d30) created by Kovid Goyal
Darwin <redacted>.localdomain 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000 arm64
ProductName:        macOS ProductVersion:       14.3.1 BuildVersion:        23D60
Frozen: True
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: /bin/zsh
Loaded config files:
  /Users/<redacted>/.config/kitty/kitty.conf

Config options different from defaults:
allow_remote_control yes
bell_on_tab          
disable_ligatures    2
enable_audio_bell    False
enabled_layouts      ['splits']
font_size            14.0
macos_option_as_alt  3
modify_font:
    cell_height 0
    cell_width -1
shell_integration    frozenset({'no-complete'})
tab_bar_style        powerline
tab_title_template   {sup.index}{title[-15:]}
Added shortcuts:
    cmd+' →  launch --location=hsplit
    cmd+/ →  launch --allow-remote-control kitty +kitten kitty_search/search.py @active-kitty-window-id
    cmd+g →  launch --stdin-source=@last_cmd_output --type=overlay $SHELL -c "nvim -"
    opt+down →  neighboring_window down
    opt+left →  neighboring_window left
    opt+right →  neighboring_window right
    opt+up →  neighboring_window up
    shift+cmd+g →  launch --stdin-source=@screen_scrollback --type=overlay $SHELL -c "nvim -"
Removed shortcuts:
    cmd+, →  edit_config_file
    cmd+h →  hide_macos_app
    cmd+k →  clear_terminal to_cursor active
    cmd+m →  minimize_macos_window
    cmd+n →  new_os_window
    cmd+q →  quit
    cmd+w →  close_tab
    ctrl+cmd+, →  load_config_file
    ctrl+cmd+f →  toggle_fullscreen
    kitty_mod+t →  new_tab
    opt+cmd+h →  hide_macos_other_apps
    opt+cmd+r →  clear_terminal reset active
    opt+cmd+s →  toggle_macos_secure_keyboard_entry
    shift+cmd+/ →  open_url https://sw.kovidgoyal.net/kitty/
    shift+cmd+[ →  previous_tab
    shift+cmd+] →  next_tab
    shift+cmd+d →  close_window
    shift+cmd+w →  close_os_window
Changed shortcuts:
    cmd+1 →  goto_tab 1
    cmd+2 →  goto_tab 2
    cmd+3 →  goto_tab 3
    cmd+4 →  goto_tab 4
    cmd+5 →  goto_tab 5
    cmd+6 →  goto_tab 6
    cmd+7 →  goto_tab 7
    cmd+8 →  goto_tab 8
    cmd+9 →  goto_tab 9
    cmd+enter →  new_window_with_cwd
    cmd+t →  new_tab_with_cwd
    kitty_mod+enter →  new_window_with_cwd
    kitty_mod+j →  launch --stdin-source=@screen_scrollback --stdin-add-formatting --type=overlay less +G -R
    kitty_mod+l →  layout_action rotate
Colors:
    background           #202020   
    color1               #fa5355   
    color10              #67ff4f   
    color11              #ffff00   
    color12              #4581eb   
    color13              #fb82ff   
    color14              #4581eb   
    color15              #eeeeee   
    color2               #126e00   
    color3               #c2c300   
    color4               #4581eb   
    color5               #fa54ff   
    color6               #4581eb   
    color7               #adadad   
    color8               #545454   
    color9               #fb7172   
    cursor               #ffffff   
    foreground           #adadad   
    selection_background #a9c1e2   
    selection_foreground #202020   

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                               /bin/zsh
    USER                                <redacted>

Additional context I removed several different variables and in ever scenario I was still able to reproduce the bug:

kovidgoyal commented 6 months ago

https://sw.kovidgoyal.net/kitty/shell-integration/#using-shell-integration-in-sub-shells-containers-etc