Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Resizing unix shells with Windows Terminal doesn't clear the previous prompt, spamming up the shell and eventually crashing windows terminal. #402

Closed
2 tasks done
AskAlice opened this issue Feb 12, 2021 · 9 comments

Comments

@AskAlice
Copy link

AskAlice commented Feb 12, 2021

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

Resizing unix shells via WSL or Windows OpenSSH doesn't clear the previous prompt, spamming up the shell and eventually crashing windows terminal.

HQ version: https://giant.gfycat.com/MiniatureThinGreatdane.webm

Environment

  • Oh my Posh version: 3.8.6
  • Theme: slim
  • Operating System: Windows 10 with WSL, and SSH
  • Shell: zsh
  • Terminal: Windows Terminal

Steps to Reproduce

  1. Open up Windows Terminal
  2. Open up a WSL or SSH session that uses zsh and oh-my-posh
  3. resize the window for 10 seconds
  4. crash windows terminal

Expected behavior: no crash, and also it should clear the prompt.

Actual behavior: it doesn't clear the prompt, and then crashes the terminal.

@AskAlice AskAlice changed the title Resizing on WSL/Windows OpenSSH doesn't clear the previous prompt, spamming up the shell and eventually crashing windows terminal. Resizing on WSL/ssh doesn't clear the previous prompt, spamming up the shell and eventually crashing windows terminal. Feb 12, 2021
@AskAlice AskAlice changed the title Resizing on WSL/ssh doesn't clear the previous prompt, spamming up the shell and eventually crashing windows terminal. Resizing on unix shells with Windows Terminal doesn't clear the previous prompt, spamming up the shell and eventually crashing windows terminal. Feb 12, 2021
@AskAlice AskAlice changed the title Resizing on unix shells with Windows Terminal doesn't clear the previous prompt, spamming up the shell and eventually crashing windows terminal. Resizing unix shells with Windows Terminal doesn't clear the previous prompt, spamming up the shell and eventually crashing windows terminal. Feb 12, 2021
@JanDeDobbeleer
Copy link
Owner

@AskAlice I understand the issue, but how is that the responsibility of the prompt generator? Oh my Posh hooks into the shell's prompt function (depends on the platform). Clearing also implies clearing the screen which is maybe not what the user wants (clearing a line is weird as you don't even know where the cursor is at that point in time). Maybe I'm not aware of something but I don't see how we can do this without opening another jar of impossible to resolve issues.

@JanDeDobbeleer JanDeDobbeleer added the 🤔 info needed Further information is requested label Feb 12, 2021
@JanDeDobbeleer
Copy link
Owner

@AskAlice I found this issue, which seems pretty close to what you're experiencing. For what it's worth, I tried to reproduce this using iTerm2 on Mac and I can't make the app crash when reproducing this.

@just1a-person
Copy link

That's right. The terminal isn't supposed to crash because of a prompt. Looking at the issue linked, This seems to be an issue with the headless Console Host that powers the Windows Terminal

@AskAlice
Copy link
Author

I went to make this issue because of the spamming of the prompt, and found it also happened to crash the terminal when done for long enough

@AskAlice
Copy link
Author

AskAlice commented Feb 12, 2021

@AskAlice I understand the issue, but how is that the responsibility of the prompt generator? Oh my Posh hooks into the shell's prompt function (depends on the platform). Clearing also implies clearing the screen which is maybe not what the user wants (clearing a line is weird as you don't even know where the cursor is at that point in time). Maybe I'm not aware of something but I don't see how we can do this without opening another jar of impossible to resolve issues.

If i use p10k with .oh-my-zsh it doesn't spam like this, so it's somehow possible within this repo to fix that, not quite sure where to start, though.

They have this special prompt that doesn't show previous prompts after you hit enter, just an arrow then what you wrote in the prompt, then the output, and eventually the current (and only visible) prompt.

@JanDeDobbeleer
Copy link
Owner

@AskAlice I also use zsh and the prompt is't being spammed in resize. Somehow it feels like Windows Terminal is doing some voodoo magic underneath. p10k leverages zsh directly, something we can't do (other than the init script). There is also more information to be found in other repos that talks directly about similar behaviour caused by RPROMPT. Coming back to the root cause of the issue, namely that your prompt is being replicated (zsh issue) and that the terminal crashes (windows terminal issue) 😅

@AskAlice
Copy link
Author

Alright feel free to close if that's the case

@JanDeDobbeleer
Copy link
Owner

JanDeDobbeleer commented Feb 12, 2021

@AskAlice maybe there's a solution in those issues we can implement in the zsh setup. I'll have to read through it more closely.

@JanDeDobbeleer
Copy link
Owner

@AskAlice a solution would be to disable wrap on resize in the terminal, however, the Windows Terminal team decided against adding the functionality (lord knows why).

@JanDeDobbeleer JanDeDobbeleer added windows zsh and removed 🤔 info needed Further information is requested labels Feb 12, 2021
Repository owner locked and limited conversation to collaborators Feb 12, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

3 participants