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

ConEmu sometimes loses the ability to print inverse text as soon as underlined text has been displayed #1302

Closed
agross opened this issue Oct 28, 2017 · 21 comments

Comments

@agross
Copy link

agross commented Oct 28, 2017

Versions

ConEmu build: 171025 x64
OS version: Windows 10 x64
Used shell version: zsh 5.1.1 (x86_64-ubuntu-linux-gnu)

Problem description

Since #1288 underlined text works. But sometimes ConEmu loses the ability to print inverse/standout text.

Steps to reproduce

Reproducible only when running WSL:

  1. sudo apt-get install zsh
  2. chsh -s "$(which zsh)"
  3. Add task for C:\Windows\System32\wsl.exe
  4. Open task
  5. export SPROMPT='zsh: correct '%R' to '%r'? %Uy%ues/%Un%uo/%Ue%udit/%Ua%ubort '
  6. setopt correct
  7. cat /mnt/path/to/ConEmu/Addons/AnsiColors16.ans
  8. sl (deliberate typo)
  9. Correction pops up, press Ctrl+C

When you stream select any text (even the text not rendered as standout) in the screenshot the bogus reverse lines turn into standout text. As soon as you leave stream selection, the text returns to a bright background.

Results

2017-10-28_22-58-22

@Maximus5
Copy link
Owner

Maximus5 commented Nov 9, 2017

This is not a ConEmu bug. ConEmu displays text using attributes returned by conhost WinAPI.
And in the first block I receive proper COMMON_LVB_REVERSE_VIDEO|COMMON_LVB_UNDERSCORE|0x40, but in the second block (after "correct sl to ...") I get erroneous COMMON_LVB_REVERSE_VIDEO|COMMON_LVB_UNDERSCORE|0x04.
Obviously because of COMMON_LVB_REVERSE_VIDEO I inverse the 0x04 and you see black text on colored background.

@agross When you use proper task with connector/wslbridge you may see proper colors and underlined text in both cases.

@miniksa Can you check that? Looks like a bug in conhost, because the RealConsole window displays proper colors in both cases, but API returns broken attributes.

@miniksa
Copy link

miniksa commented Nov 9, 2017

Filed internally as MSFT:14593728. We'll get to it. Thanks for the report.

@agross
Copy link
Author

agross commented Nov 10, 2017

@Maximus5

When you use proper task with connector/wslbridge you may see proper colors and underlined text in both cases.

Do you mean by "proper" that I would need to run WSL zsh like this (task contents)?

"%ConEmuBaseDir%\conemu-cyg-64.exe" --wsl -cur_console:pm:/mnt /usr/bin/zsh --interactive --login

Unfortunately I can't because in this case the console window stays empty.

On the other hand, WSL bash works:

"%ConEmuBaseDir%\conemu-cyg-64.exe" --wsl -cur_console:pm:/mnt

@agross
Copy link
Author

agross commented Nov 25, 2017

@Maximus5 Could you please comment on my last question?

Do you mean by "proper" that I would need to run WSL zsh like this (task contents)?

@Maximus5
Copy link
Owner

The following is working in my tests

set "PATH=%ConEmuBaseDir%\wsl;%PATH%" & "%ConEmuBaseDir%\conemu-cyg-64.exe" --wsl -t /usr/bin/zsh -i -l -cur_console:p:m:/mnt

@agross
Copy link
Author

agross commented Nov 26, 2017

Aha, -t did the trick. Many thanks! (Still, lots of these options seem like black magic to me as bash doesn't require -t.)

@Maximus5
Copy link
Owner

-t is a switch of wslbridge. Bare --wsl implies it.

@agross
Copy link
Author

agross commented Nov 26, 2017

Bare --wsl implies it.

That's strange, just tested again. --wsl -t works while bare --wsl does not (the shell blocks and I need to kill it). Can you please verify?

@Maximus5
Copy link
Owner

What command line did you test exactly?

@agross
Copy link
Author

agross commented Nov 26, 2017

Just the normal zsh startup (mind the -t):

"%ConEmuBaseDir%\conemu-cyg-64.exe" --wsl -t -cur_console:pm:/mnt /usr/bin/zsh --interactive --login

This works, without -t the shell never gets into a state where I can enter text. I can Ctrl+C to exit the shell and close the ConEmu tab.

@Maximus5
Copy link
Owner

Yes, of course. Your command is not "bare --wsl".

@agross
Copy link
Author

agross commented Nov 26, 2017

Of course what? And what do you mean by "bare --wsl"?

@Maximus5
Copy link
Owner

If you do specify any arguments after --wsl all these arguments are passed to wslbridge without changes, in your case it's /usr/bin/zsh --interactive --login. ConEmu doesn't modify them.

@agross
Copy link
Author

agross commented Nov 26, 2017

That doesn't make it clearer to me. You said earlier, that --wsl implies -t. Why do I see a difference in behavior if I leave out -t?

@Maximus5
Copy link
Owner

I said "bare --wsl". The "%ConEmuBaseDir%\conemu-cyg-64.exe" --wsl implies -t!

@agross
Copy link
Author

agross commented Nov 26, 2017

So -cur_console:pm:/mnt makes it non-bare?

@Maximus5
Copy link
Owner

All -cur_ and -new_console switches are processed by ConEmu internally! Connector doesn't receive them.

-new_console

@Maximus5
Copy link
Owner

As I said before

in your case it's /usr/bin/zsh --interactive --login

@agross
Copy link
Author

agross commented Nov 26, 2017

I hope I get it now:

By "bare" --wsl you mean that no non-internal arguments come after --wsl. If one adds a shell to be run (/usr/bin/zsh --interactive --login in my case), this makes it non-bare.

For bash I don't specify a shell, hence "%ConEmuBaseDir%\conemu-cyg-64.exe" --wsl -cur_console:pm:/mnt is bare, despite the internally processed -cur_console:pm:/mnt. In this case -t is implied, whereas it's not implied for the zsh invocation above.

@Maximus5
Copy link
Owner

Exactly. I don't know how to explain it shorter.

@agross
Copy link
Author

agross commented Nov 26, 2017

Thanks for the clarification!

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

No branches or pull requests

3 participants