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

UCM on Windows gives strange prompt #3275

Closed
meijeru opened this issue Jul 26, 2022 · 19 comments · Fixed by #3307
Closed

UCM on Windows gives strange prompt #3275

meijeru opened this issue Jul 26, 2022 · 19 comments · Fixed by #3307

Comments

@meijeru
Copy link

meijeru commented Jul 26, 2022

I am running release/M4 of ucm.exe on Windows 11. The prompt is [0m[32m.[0m> [0m which seems to indicate a wrong interpretation of ANSI escape sequences by my terminal application (both Windows Console Host and Windows Terminal exhibit this behaviour). The multicolour ASCII art in the banner is displayed correctly, though.

@meijeru
Copy link
Author

meijeru commented Jul 26, 2022

Additionally, but I don't know if it is strictly related, non-ASCII characters (e.g. emojis) are not displayed correctly. Instead, I see boxed question marks.

@ceedubs
Copy link
Contributor

ceedubs commented Jul 27, 2022

haskell/haskeline#130 seems like it might be related to the prompt issue. It suggests https://github.com/judah/haskeline/wiki/ControlSequencesInPrompt as a potential workaround (as the actual fix PR seems to have gone stale). I lack a Windows machine to test it on.

Not sure about emojis. There seem to be some dragons here for Windows. That's a bummer; I thought that we were well into the age of Unicode.

@meijeru
Copy link
Author

meijeru commented Jul 27, 2022

@ceedubs The emojis are less of a concern, and I see from the Windows issue you linked, that we will have to be patient anyhow. But the ANSI sequences being mishandled is more serious. I appeal to the developers of UCM to have a close look, because it used to work in M2 and (I think) M3. So something broke it.

@mardukbp
Copy link

mardukbp commented Aug 7, 2022

I found out that it looks fine on GitBash. Could be a reasonable temporary solution.

As for Emojis and ANSI sequences on Windows, I can confirm that they work. I spent a couple of days last week patching Elixir to make it work with a patched version of OTP 26, that has a new cross-platform TTY. Emojis cannot be displayed in cmd.exe or pwsh.exe. A modern terminal is needed, like Windows Terminal, WezTerm or Alacritty.

@meijeru
Copy link
Author

meijeru commented Aug 7, 2022

I have tried Windows Terminal, but it does not help with the prompt. Where does one get GitBash?

@mardukbp
Copy link

mardukbp commented Aug 8, 2022

It comes bundled with Git for Windows.

@jayber
Copy link

jayber commented Aug 11, 2022

If it helps, when I run GitBash on its own, this works.
And when I add git-bash.exe to windows terminal so that it opens in its own window and not in a terminal tab, it works.
But when I get it to run in the terminal tab, by following this guide: https://www.timschaeps.be/post/adding-git-bash-to-windows-terminal/
the weird prompt is back
image

@mardukbp
Copy link

Yes, that is expected. The guide shows how to execute bash.exe (which is a shell, just like cmd.exe or pwsh.exe) within Windows Terminal (a terminal emulator, just like WezTerm or Alacrity). To my knowledge haskeline works on MinGW, which has its own terminal emulator and is the one used by GitBash.

@meijeru
Copy link
Author

meijeru commented Aug 16, 2022

I have now downloaded the latest pre-release (723eaf6) and it shows the following:

 Now starting the Unison Codebase Manager (UCM)...
�
  �� _____��     _             �
  ��|  |  |��___��|_|��___ ��___ ��___ �
  ��|  |  |   ��| |��_ -��| . |��   |�
  ��|_____|��_|_��|_|��___��|___|��_|_|�

  👋 Welcome to Unison!

  You are running version: ��723eaf6�
�
  Get started:

    📖 Type ��help� to list all commands, or ��help <cmd>� to view help for one command
    🎨 Type ��ui� to open the Codebase UI in your default browser
    📚 Read the official docs at ��https://www.unison-lang.org/learn/�
    🌎 Visit Unison Share at ��https://share.unison-lang.org� to discover libraries
    👀 I'm watching for changes to ��.u� files under ��C:\Users\rudol\Projects\Unison�
�.>`

At least some of the ANSI codes are gone, but other unreadables have taken their place! It looks like this has to do with color (the emojis look OK).

@mardukbp
Copy link

mardukbp commented Aug 16, 2022 via email

@aryairani
Copy link
Contributor

aryairani commented Aug 16, 2022

You're not supposed to have to chcp 65001 for ucm anymore, but I would want to know if that helps. If it does, that's a regression.

@aryairani
Copy link
Contributor

aryairani commented Aug 16, 2022

I think a better fix than #3307 is probably along the lines of haskell/haskeline#130, but it means resurrecting our haskeline fork to apply the patch. I'm looking into reproducing the new behavior Rudolf posted.

@meijeru
Copy link
Author

meijeru commented Aug 16, 2022

FYI: chcp65001 does not help.

@mardukbp
Copy link

I downloaded the latest pre-release. WezTerm can correctly display ucm's welcome message. Maybe it is a good idea to take a look at the code and see what it is doing.

@aryairani
Copy link
Contributor

Everyone should please include screen shots when describing visually weird or non-weird output 🙏

@mardukbp
Copy link

mardukbp commented Aug 28, 2022

Running ucm from latest pre-release (August 27th 2022):

  • on WezTerm with Powershell 7 as shell

grafik

  • on PowerShell 7

grafik

  • on Windows Terminal with Powershell 7 as shell

grafik

@aryairani I wonder why the Get Started section is empty. Any ideas?

@mardukbp
Copy link

mardukbp commented Oct 1, 2022

The release M4b improved things, but this issue is still not solved. @aryairani Why is it closed?

grafik

@meijeru
Copy link
Author

meijeru commented Oct 19, 2022

I am on W11 using M4a with Windows Console Host and I have no problems anymore. Did not test M4b or M4c though.

@mardukbp
Copy link

I can confirm that M4c works! Thanks a lot Unison team :)

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

Successfully merging a pull request may close this issue.

5 participants