Auto-suggestion opacity #6566

Closed
opened 2026-01-31 00:41:48 +00:00 by claunia · 11 comments
Owner

Originally created by @Mansour-J on GitHub (Feb 21, 2020).

Environment

  • Environment Microsoft Windows [Version 10.0.18363.657]
  • other software ? zsh, zsh-autosuggestion

Steps to reproduce

  1. SSH into a Linux, or OSX box that has command line auto-suggestion set up (I have a CentOS with zsh, zsh-autosuggestion)

I have a Linux box that has ZSH and ZSH auto-suggestion plugin that does a look up through the commands history and suggests the last command I used. I love that feature and actually makes me very productive specially with long commands....

Expected behavior

The suggested command should be half with opacity and half selected as follow:
image

Actual behavior

This is what I get... where the cursor is actually is the position of what I write, after cursor meant to be with opacity to indicate that it is a suggestion.

image

It's very interesting, I was thinking that the problem is from my installation but I SSH-ed to my box through an android app. The auto-correction works fine on my android phone but not on Windows PC.
image

Please fix this 🌹🌹

BTW this terminal is awesome keep up the good work

Originally created by @Mansour-J on GitHub (Feb 21, 2020). # Environment - Environment Microsoft Windows [Version 10.0.18363.657] - other software ? `zsh`, `zsh-autosuggestion` # Steps to reproduce 1. SSH into a `Linux`, or `OSX` box that has command line auto-suggestion set up (I have a CentOS with `zsh`, `zsh-autosuggestion`) > I have a Linux box that has ZSH and ZSH auto-suggestion plugin that does a look up through the commands history and suggests the last command I used. I love that feature and actually makes me very productive specially with long commands.... # Expected behavior The suggested command should be half with opacity and half selected as follow: ![image](https://user-images.githubusercontent.com/12991664/75027016-c44e9000-5502-11ea-98a2-354e11fba93e.png) # Actual behavior This is what I get... where the cursor is actually is the position of what I write, after cursor meant to be with opacity to indicate that it is a suggestion. ![image](https://user-images.githubusercontent.com/12991664/75027259-1a233800-5503-11ea-963b-3fad0395212e.png) It's very interesting, I was thinking that the problem is from my installation but I SSH-ed to my box through an android app. The auto-correction works fine on my android phone but not on Windows PC. ![image](https://user-images.githubusercontent.com/12991664/75027396-64a4b480-5503-11ea-84f3-375b3fd13a55.png) Please fix this 🌹🌹 BTW this terminal is awesome keep up the good work
claunia added the Resolution-ExternalNeeds-Tag-Fix labels 2026-01-31 00:41:49 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 21, 2020):

What is the value of your ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE environment variable?

@DHowett-MSFT commented on GitHub (Feb 21, 2020): What is the value of your `ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE` environment variable?
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 21, 2020):

And what are the color values in the color scheme you're using?

@DHowett-MSFT commented on GitHub (Feb 21, 2020): And what are the color values in the color scheme you're using?
Author
Owner

@Mansour-J commented on GitHub (Feb 22, 2020):

@DHowett I did not originally have any, but now that you mentioned I tried with setting it to 30 it's still the same. Whereas if I set the ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=5 it will look like this:

image

I recently added Dracula theme to the Windows Terminal but before Windows Terminal I used to SSH through Git Bash terminal and CMD with their default profile and they both had the same issue.

It could be that styling commands has some limitation? like Opacity can't be applied to a command?

@Mansour-J commented on GitHub (Feb 22, 2020): @DHowett I did not originally have any, but now that you mentioned I tried with setting it to `30` it's still the same. Whereas if I set the `ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=5` it will look like this: ![image](https://user-images.githubusercontent.com/12991664/75081729-1cbe7580-5575-11ea-942f-36799497086d.png) > I recently added [Dracula](https://draculatheme.com/windows-terminal/) theme to the `Windows Terminal` but before `Windows Terminal` I used to SSH through `Git Bash` terminal and `CMD` with their default profile and they both had the same issue. It could be that styling commands has some limitation? like `Opacity` can't be applied to a command?
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 22, 2020):

What's your color scheme look like? 30 maps to black and 1;30 (or bold, fg=0) maps to brightBlack.

@DHowett-MSFT commented on GitHub (Feb 22, 2020): What's your color scheme look like? `30` maps to `black` and `1;30` (or bold, fg=0) maps to `brightBlack`.
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 22, 2020):

I see, sorry - I didn't register that Dracula was a link. Can you try fg=0 instead of 30? zle_highlight adds the 30 on its own.

@DHowett-MSFT commented on GitHub (Feb 22, 2020): I see, sorry - I didn't register that Dracula was a link. Can you try `fg=0` instead of `30`? zle_highlight adds the 30 on its own.
Author
Owner

@Mansour-J commented on GitHub (Feb 22, 2020):

I changed it to fg=0 and now the second part is barely readable :)

Below picture I increased font size to so that we can see it a bit

image

if you click on the picture it might be more visible the second part

@Mansour-J commented on GitHub (Feb 22, 2020): I changed it to `fg=0` and now the second part is barely readable :) Below picture I increased font size to so that we can see it a bit ![image](https://user-images.githubusercontent.com/12991664/75084226-96f5f680-5583-11ea-9f5c-12cf0accc6d1.png) if you click on the picture it might be more visible the second part
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 22, 2020):

There are eight colors (0-7) for you to choose from; perhaps one of them will work in the near-term until we can figure out what zle_highlight defaults to?

@DHowett-MSFT commented on GitHub (Feb 22, 2020): There are eight colors (0-7) for you to choose from; perhaps one of them will work in the near-term until we can figure out what zle_highlight defaults to?
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 22, 2020):

I’m betting it’s defaulting to “faint”, which is something we don’t support right now. That one isn’t a color, but a style.

@DHowett-MSFT commented on GitHub (Feb 22, 2020): I’m betting it’s defaulting to “faint”, which is something we don’t support right now. That one isn’t a color, but a style.
Author
Owner

@Mansour-J commented on GitHub (Feb 22, 2020):

I couldn't check what it falls back to. But below documentation says what's the default behavior is:

image

There are eight colors (0-7) for you to choose from;

Yes indeed, I can change it to 8 different colors.

I’m betting it’s defaulting to “faint”, which is something we don’t support right now. That one isn’t a color, but a style.

Is that the conclusion ?

@Mansour-J commented on GitHub (Feb 22, 2020): I couldn't check what it falls back to. But below documentation says what's the default behavior is: ![image](https://user-images.githubusercontent.com/12991664/75086448-28239800-5599-11ea-985e-df708476a3a8.png) >There are eight colors (0-7) for you to choose from; Yes indeed, I can change it to 8 different colors. >I’m betting it’s defaulting to “faint”, which is something we don’t support right now. That one isn’t a color, but a style. Is that the conclusion ?
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 22, 2020):

Alright, I had a look into it today and installed zsh-autosuggestions.

It appears as though the default is fg=8, which means "color 8 from the 256-color palette". This is important.

If zsh doesn't think your terminal supports 256 colors (WT does (!)), it will simply not set a color. It'll look at the color at index 8 and say "well, there's no way I can accomplish that" and give up.

Why doesn't it think we support that many colors? I think the ssh client is setting the wrong TERM value! I'm seeing xterm instead of something like xterm-256color or xterm-88color. This might be configurable.

Now, when I set my TERM value to xterm-256color zsh-autosuggestions magically starts working right:

image

In short, looks like a configuration problem -- perhaps with the ssh client -- rather than something Terminal can help.

@DHowett-MSFT commented on GitHub (Feb 22, 2020): Alright, I had a look into it today and installed zsh-autosuggestions. It appears as though the [default](https://github.com/zsh-users/zsh-autosuggestions#suggestion-highlight-style) is `fg=8`, which means "color 8 from the 256-color palette". _This is important._ If zsh doesn't think your terminal supports 256 colors (WT does (!)), it will simply not set a color. It'll look at the color at index 8 and say "well, there's no way I can accomplish that" and give up. Why doesn't it think we support that many colors? I think the ssh client is setting the wrong TERM value! I'm seeing `xterm` instead of something like `xterm-256color` or `xterm-88color`. This might be configurable. Now, when I set my `TERM` value to `xterm-256color` zsh-autosuggestions magically starts working right: ![image](https://user-images.githubusercontent.com/14316954/75098800-7623a600-556f-11ea-8aa0-ca4c2983dc9a.png) In short, looks like a configuration problem -- perhaps with the ssh client -- rather than something Terminal can help.
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 22, 2020):

Oh, and echotc Co will tell you how many colors your TERM is telling it that your terminal can use.

@DHowett-MSFT commented on GitHub (Feb 22, 2020): Oh, and `echotc Co` will tell you how many colors your `TERM` is telling it that your terminal can use.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6566