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

Reflow patch: replicated shell prompt #124

Open
step- opened this issue Mar 14, 2024 · 3 comments
Open

Reflow patch: replicated shell prompt #124

step- opened this issue Mar 14, 2024 · 3 comments

Comments

@step-
Copy link
Contributor

step- commented Mar 14, 2024

The shell prompt gets replicated when I resize the window with reflow patch enabled.

Reproduce:
patches.h.txt

  • Enable patch. patches.h.txt
  • Run st -c fish &.
  • Press Enter to show two prompt lines in the terminal.
  • Resize small enough to affect the prompt area, resize larger, repeat a few times.

Video: https://github.com/bakkeby/st-flexipatch/assets/1414102/3f37b42b-a4ba-409c-af7c-5ef8dd9b8e44

I chose fish for the video because the provides a fancy prompt by default. I suspect this issue has to do with ANSI escape codes in the prompt variable. I can reproduce it in bash and zsh with custom fancy prompts. However, I can't reproduce if the prompt is plain text, such as PS1="long long prompt# ".

@veltza
Copy link
Contributor

veltza commented Mar 14, 2024

The reason for the issue is that both the terminal and the shell are trying to reflow the prompt at the same time and here is the result. Since the issue still occurs on other terminals (Alacritty, Wezterm, Xfce terminal etc.) as well, I don't think there is an easy solution to it. Kitty tries to mitigate this by using delayed drawing, but it's not perfect either.

@step-
Copy link
Contributor Author

step- commented Mar 14, 2024

Thank you. My fancy prompt is quite short anyway, so I won't see this behavior very often. I note that tmux seems to know how to reflow the prompt correctly.

@bakkeby
Copy link
Owner

bakkeby commented Mar 14, 2024

Yes I have seen this prompt resize issue with practically every terminal I have tested.

Starting to write a command at the middle to right hand side of the terminal never felt that good to me. Adding a newline and having the prompt at the far left means that all commands start from the same position.

image

Incidentally that also fixed the repeated shell prompt issue for me (across terminals).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants