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
Comments are invisible #510
Comments
Nevermind, I found a solution: ZSH_HIGHLIGHT_STYLES[comment]='none' |
Comments are highlighted in gray. Your terminal's colour scheme may be out of tune. |
Terminology with solarized-light theme.
Thank you. |
@danielshahaf Isn't it hard coded as black?
Any string starting with a # or $ is completely invisible. I tested in many different terminals with their built in theme. Only iTerm2 shows grayish color. Then I find out that's because iTerm2 sets a minimum contrast. I also tried ssh to a ubuntu server. #string is colored red while $string is also invisible. That seems like unsetopt INTERACTIVE_COMMENTS . But still in ubuntu the default color is also black.
|
For For
It shows as grey in a plain xterm and libvte, at least.
The color codes are decided by the terminal emulator running locally. ssh'ing wouldn't affect the outcome at all, unless the remote box generates different escape sequences than the local box. You haven't proposed an alternative. |
I tried xterm on my mac through a x server. It also shows as black. But it's mac. I could be wrong. BTW, I know ssh should not make a difference. I just find that INTERACTIVE_COMMENTS is unset by default on the remote machine. |
Well, maybe. Or maybe those terminals that use the same colour values for "bold black" and "background" are buggy. If they use TERM=xterm, I'd argue they are, because xterm itself doesn't do that.
Hmm. Interesting. First, can we assume the terminal supports 256 colours, or do we need to check this, and if so, how to check this portably? Second, do all supported zsh versions support 256-colour values in the colour specification syntax? Reopening. Thoughts, anyone? |
|
xterm's default behaviour is to render bold black as grey. Indeed, that can be disabled with the
That's a red herring. All that z-sy-h assumes is that that a standard foreground colour is readable against the default background colour.
What colour would that be? There's { black/red/green/yellow/blue/magenta/cyan/white } × { bright, non-bright }.
I was thinking more of
Thanks, that's very helpful. The oldest bug report I remember is from a 4.3.9 user in 2016, so 4.3.10 today should be more than old enough. |
on my mac, i use alacritty, iterm2 and terminal. They all have this feature. But they are all disabled by default. Not all programs relies on this feature. They can explicitly specify bright black color
sorry. grey as a name is not supported in zsh. From what I remember you can use 'grey' in Vim. It's actually bright black. But since 256 colors is ok. you can explicitly use fg=8. This does not change anything. Your intention is to use brightened black. Am I correct? A quote from zsh manual
This built in command is already there for version 4.3.10. So we could take advantage of it directly. How about this?
|
> What colour would that be? There's { black/red/green/yellow/blue/magenta/cyan/white } × { bright, non-bright }.
sorry. grey as a name is not supported in zsh. From what I remember you
can use 'grey' in Vim. It's actually bright black. But since 256 colors
is ok. you can explicitly use fg=8. This does not change anything. Your
intention is to use brightened black. Am I correct?
The code currently uses `fg=black,bold`. That's what we've been discussing all along. (And to be precise, "bold" and "bright" aren't the same thing, in xterm at least.)
A quote from zsh manual
`On recent terminals and on systems with an up-to-date terminal
database the number of colours supported may be tested by the command
‘echotc Co’; if this succeeds, it indicates a limit on the number of
colours which will be enforced by the
line editor. The number of colours is in any case limited to 256 (i.e.
the range 0 to
255).
`
This built in command is already there for version 4.3.10. So we could
take advantage of it directly.
Yeah, though we try to avoid forks for Cygwin, and there remains the question of whether the value would be correct (i.e., whether fg=245 would work whenever the number of colours reported is 256).
|
fg=8,bold then. BTW, bright black's translation should be color 8.
If it reports 256 but does not really work, it's the problem of terminal developer. But at least I just had a try on cygwin. It's working when i set TERM to xterm-256color Just noticed this |
What's the difference between
Well, yes, but the design process doesn't stop at that. Behaviour in failure modes needs to be considered too.
So zsh-autosuggestions uses |
There is not difference on environments with 256 colors support; on 16 colors environment, it seems to fall back to default foreground, which is at least better than being invisible. This fallback seems controlled by zsh, so should be safe?
It has been that way since that file was created. |
Possibly, but there's no point in checking unless we know of at least one terminal where fg=8,bold behaves better than fg=black,bold does.
That's certainly relevant, but doesn't answer the question you were asked. |
@danielshahaf Thought I drop in a datapoint in favor of |
This is a commonly used technique: https://unix.stackexchange.com/questions/33994/zsh-interpret-ignore-commands-beginning-with-as-comments?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
But with zsh-syntax-highlighting turned on, all characters after
#
become invisible.The text was updated successfully, but these errors were encountered: