mikesmithgh / kitty-scrollback.nvim

😽 Open your Kitty scrollback buffer with Neovim. Ameowzing!
Apache License 2.0
438 stars 11 forks source link

bug: ksb_builtin_last_visited_cmd_output doesn't capture everything #249

Closed CabalCrow closed 1 month ago

CabalCrow commented 4 months ago

Use map Ctrl+Super+z kitty_scrollback_nvim --config ksb_builtin_last_visited_cmd_output produces an empty scrollback (full scrollback & last command function normally).

Previously I used.

map Ctrl+Super+z launch --stdin-source=@last_visited_cmd_output --type=overlay nvim -R
map Ctrl+Super+e scroll_to_prompt -1
map Ctrl+Super+u scroll_to_prompt 1

I use the prompts to scroll to the entry I want & then use the last_visited_cmd output which works normally. When using the map I provided at the top it just provides an empty buffer. Same applies to the default keybind (provided from kitty-scrollback.nvim) that uses the mouse.

mikesmithgh commented 4 months ago

Hi @BigCrow thank you for reporting.

I added the config

map Ctrl+Super+z launch --stdin-source=@last_visited_cmd_output --type=overlay nvim -R
map Ctrl+Super+e scroll_to_prompt -1
map Ctrl+Super+u scroll_to_prompt 1

and did some testing.

I am seeing inconsistent results when I use scroll_to_prompt. When I haven't ran enough commands to scroll the window or if the command output is really small scroll_to_prompt doesn't seem to navigate properly.

When the command outputs are long enough and after Ctrl+Super+e, Ctrl+Super+z starts to get the output. What version of Kitty are you using? I'm on kitty 0.34.1 (7f61f1f9f3)

Could you provide a video of the issue to help me troubleshoot? I am trying to determine if this is an issue with Kitty or kitty-scrollback.nvim.

CabalCrow commented 4 months ago

Version: kitty 0.33.1 created by Kovid Goyal

Video

You are right about kitty also having an issue, but it is unrelated to the current issue. Kitty works properly when the prompt can be scrolled as you said. When it can't be scrolled it requires you to use the keybinds in reverse for some reason.

Example: When you have long prompt, pressing up goes up and then you can visit that command output. On a short prompt, pressing up does nothing, but pressing down would select the top prompt that can be visited. If you have multiple commands you still can only select the top one. It seems that you need to scroll the screen for the 'last visited' command to change, and if you can't scroll the screen the top one is selected.

As for the issue with this plugin, it just never outputs the scrollback text when using last_visited_cmd_output (last_cmd_output works properly), even when invoking nvim directly works.

mikesmithgh commented 4 months ago

@BigCrow Thanks for the info. I am still having trouble reproducing the issue. In your video example, what keys are you pressing? Are you using scroll_to_prompt shortcuts anywhere? Also, what shell are you using?

In my video, you can see if behaves the same if there has been no scroll_to_prompt and after Ctrl+Super+u triggers a scroll_to_prompt.

https://github.com/mikesmithgh/kitty-scrollback.nvim/assets/10135646/dff38b6c-f9ee-4065-9be8-1e763b96b0b6

CabalCrow commented 4 months ago

I'm using zsh. First I scroll to prompt and use the inbuilt command in kitty to access the last visited output, which works. Then I scroll to prompt down then up again, then I use the kitten command from the plugin.

I just tested on bash and it still works the same, however I actually managed to catch an error this time (because I ran it via kitty bash in a seperate terminal). This error occurs every time I run any kitten function provided by this plugin (scrollback, last command, last visited):

[142 16:16:37.827156] [PARSE ERROR] Escape codes to resize text area are not supported
[142 16:16:37.827168] [PARSE ERROR] Unsupported screen mode:  69 (private)
[142 16:16:37.874103] [PARSE ERROR] Escape codes to resize text area are not supported
mikesmithgh commented 3 months ago

Hi @CabalCrow sorry for the delay.

I am still not able to reproduce this issue.

Could you retry with the branch debug-249? I have added debug statements to gather information. Then respond with the logs located at ~/.local/share/nvim/kitty-scrollback.nvim/debug/scrollback_cmd.log ?

Could you also let me know exactly what sequences of keys you press? For example, something similar to:

  1. ran command: ls
  2. ran command: echo hi
  3. pressed: ctrl+super+e
  4. pressed: ctrl+super+u
  5. pressed: ctrl+super+e
  6. pressed: ctrl+super+z
mikesmithgh commented 1 month ago

Hey @CabalCrow , I am closing this for now as I can't reproduce. Feel free to reopen if you are still having issues.