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

Running the fuzzy finder (tab) within a session clears the screen and hides command history #262

Closed
jrop opened this issue Dec 15, 2020 · 9 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jrop
Copy link

jrop commented Dec 15, 2020

I have my shell set up with the following configuration:

  • fish
  • starship prompt

Relatively predictably (I'd say around 50% of the time), when I switch "tabs", the prompt does not display until I press "enter". Also, the terminal state is not fully restored reliably. That is, if I have typed a previous command, and I switch away from the tab, and then back, the output of the command I previously ran is not reliably shown.

@austinjones austinjones added the bug Something isn't working label Dec 16, 2020
@austinjones
Copy link
Owner

austinjones commented Dec 16, 2020

Hi @jrop,
Thanks for the bug report! I use fish and starship as well. I'll see if I can reproduce the prompt issue.

The second issue you describe seems strange. Are you invoking tab with multiple users? For security reasons, the daemon runs under the context of your local user account when you invoke tab. If you launch tab foo, disconnect, and then run sudo tab foo, two daemons/sessions would be launched and the behavior would be similar to what you describe.

If you can reproduce this, could you upload the daemon logfile? On OSX it is at ~/Library/Application Support/tab/daemon.log, and on Linux it is at ~/.local/share/tab/daemon.log.

@austinjones austinjones self-assigned this Dec 16, 2020
@jrop
Copy link
Author

jrop commented Dec 22, 2020

@austinjones I don't see anything abnormal in the logs:

15:23:55.995 DAE [INFO] Resizing tab 0 to (110, 56)
15:24:12.553 DAE [INFO] Resizing tab 1 to (110, 56)
15:24:15.514 DAE [INFO] Resizing tab 0 to (110, 56)
15:24:17.772 DAE [INFO] Resizing tab 1 to (110, 56)
15:24:20.528 DAE [INFO] Resizing tab 0 to (110, 56)
15:24:23.568 DAE [INFO] Resizing tab 1 to (110, 56)
15:24:25.993 DAE [INFO] Resizing tab 0 to (110, 56)
15:24:31.816 DAE [INFO] Retasking subscription from TabId(0) to Some(TabId(1))
15:24:31.816 DAE [INFO] Resizing tab 1 to (110, 56)
15:24:35.279 DAE [INFO] Retasking subscription from TabId(1) to Some(TabId(0))
15:24:35.280 DAE [INFO] Resizing tab 0 to (110, 56)

@austinjones
Copy link
Owner

austinjones commented Dec 22, 2020

Thanks for uploading the log! This rules out all the PTY connection and session init code. That looks like a typical retasked session (when you type tab <name> within a session).

I think somehow scrollback is not being delivered to your client when it is retasked. And when you press enter, it triggers new stdout data. This is starting to make sense...

@austinjones austinjones added this to the 0.5.4 milestone Dec 23, 2020
@austinjones
Copy link
Owner

I think I have a fix for this! It looks like the cause was an integer underflow in the scrollback buffer code, which caused the buffer to believe that it was massive. The buffer would be emptied, and keep being emptied as data arrived.

@jrop
Copy link
Author

jrop commented Dec 23, 2020

@austinjones awesome! I can't wait to try the fix out! (probably tomorrow)

@austinjones
Copy link
Owner

austinjones commented Dec 24, 2020

Ah! The cause here is typing tab with no arguments inside a session. I reconstructed the raw stdout from your debug logs, cat'd it, and started seeing fuzzy finder output (was very surprising) :D

Nothing is being lost. The fuzzy finder output is being saved to the session, and replayed when you reconnect. It includes escape sequences that clear the screen. Thus, no history.

Quick workaround is to use ctrl-T instead of tab with no args to escape from a session. Should have a fix soon though!

@austinjones
Copy link
Owner

I can see why this was so confusing. It looks identical to the ctrl-T fuzzy finder! What a bug...

@jrop
Copy link
Author

jrop commented Dec 24, 2020

@austinjones Ah! Very interesting I should have probably just posted an asciinema, and all would have been clear right away. Thank you for your help in tracking this down!

@austinjones austinjones changed the title Upon switching/detaching (tab -z), prompt is not shown until <ENTER> is pressed. Running the fuzzy finder (tab) within a session clears the screen and hides command history Dec 27, 2020
@austinjones
Copy link
Owner

Hey @jrop,
@foisonocean I just released v0.5.4 with a quick workaround (now it'll print a message suggesting ctrl-T). In v0.6.0 I'm going to add full retask support, so the outer command-client will be switched into fuzzy-finder mode. Tracking that one in #294

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants