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

Cursor not visible when moving #3

Closed
bagnaram opened this issue Jul 22, 2021 · 22 comments · Fixed by #4
Closed

Cursor not visible when moving #3

bagnaram opened this issue Jul 22, 2021 · 22 comments · Fixed by #4

Comments

@bagnaram
Copy link

bagnaram commented Jul 22, 2021

Describe the Issue
I can not see the cursor when activating this theme. I am using Alacritty with the Dracula color scheme.
Zinit is my ZSH plugin manager

Expected behavior
I should be able to see the cursor when moving it from character to character.

Screenshots
See comment below

Additional context
My workaround is to modify the cursor highlight style.

zinit wait lucid for \
 atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" \
    zsh-users/zsh-syntax-highlighting \
 atload"ZSH_HIGHLIGHT_STYLES[cursor]='fg=#9580ff'" \
    dracula/zsh-syntax-highlighting \
@bigpick
Copy link
Collaborator

bigpick commented Jul 22, 2021

I don't use alacritty so forgive me if things come off as naive, still looking into things - but if I just download alacritty and fire up a new session of it with nothing other than

import:
  - /path/to/dracula.yml

window:
  title: "Dracula Test Stuff"
  dynamic_title: false

I don't seem to have any particular issue with the cursor, gives the standout effect as intended.

This sounds like something being an issue with the terminal emulator/how its handling something.

What is your XTERM?

echo $TERM
xterm-256color

is what's working for me, I imagine the alacritty profile isn't supporting standout

could you try running:

echo `tput smso`standout`tput rmso`

and show what it is?

Screen Shot 2021-07-22 at 12 11 55 PM

@bagnaram
Copy link
Author

bagnaram commented Jul 22, 2021

Thanks for the quick response!
grim-2021-07-22_11-07-1626971795

And here is a screenshot demonstrating the issue. I notice it only appears with certain highlighting colors

recording.mp4

@bagnaram
Copy link
Author

bagnaram commented Jul 22, 2021

It appears to be some sort of conflict with the "dracula-pro" alacritty theme. I need to further investigate. The cursor behaviour seems to be different depending what cursor foreground is set to in alacritty.yaml

@bigpick
Copy link
Collaborator

bigpick commented Jul 22, 2021

Strange; for reference, on an unknown token, still works for me as well:

Screen Shot 2021-07-22 at 1 35 50 PM

... so does indeed seem to be an issue with the difference between the pro/non pro version.

To confirm, if you try replacing with the non-pro values:

colors:
  primary:
    background: '0x282a36'
    foreground: '0xf8f8f2'
  cursor:
    text: CellBackground
    cursor: CellForeground
...

does it then work for you for the above scenario?

@bagnaram
Copy link
Author

Actually this does not work for me either. I am seeing the same issue except now I do not see the cursor appear on any tokens.

@bigpick
Copy link
Collaborator

bigpick commented Jul 22, 2021

D: lol OK, so that's not it. It is hard for me to play with/look much into without having Pro, so apologies;

I guess as a more general sanity test, if you switch to using entirely the non-pro theme for alacritty, https://github.com/dracula/alacritty/blob/master/INSTALL.md#install, does it then work?

Trying to figure out if its a Dracula pro issue or an alacritty issue (am leaning towards the former, since it works on my barebones alacritty, but then again, i'm using xterm-256color for my TERM -- additional note, what's your

echo $TERM

@bagnaram
Copy link
Author

It is kind of a bizarre situation but I have tried reducing my alacritty config to default theme and disabling all zsh plugins except for this one and I cannot get around the standout option when hovering over syntax tokens.

alacritty 0.8.0-1 is my release

As mentioned above my term is alacritty-direct but I also tried the xterm one to no avail.
I think it has to do with using standout over colored text and alacritty is not displaying it or something.

@bigpick
Copy link
Collaborator

bigpick commented Jul 22, 2021

Oh shoot, my bad, missed that in your screenshot above, right, thanks.

I can try messing with my TERM value in a little bit when I'm near my computer again; will check my alacrity release too (originally grabbed just whatever is in homebrew currently)

@bagnaram
Copy link
Author

As a side note I tried it in Terminology terminal and it appears to work fine there. Maybe its an upstream Alacritty issue once we validate versions

@bigpick
Copy link
Collaborator

bigpick commented Jul 22, 2021

Mine is:

λ  alacritty --version
alacritty 0.8.0 (a1b13e6)

... so

echo -e "\e[7m is this standout? \e[27m"
# and/or
echo `tput smso`standout`tput rmso`

both result in standout coloring for you, so I agree, its something with how the colors are interacting that is prevneting it, since your setup definitely supports standout

... and using alacritty or alacritty-direct for me still results in proper standout highlighting on all tokens

@bigpick
Copy link
Collaborator

bigpick commented Jul 22, 2021

I just built the latest upstream

git rev-parse HEAD
78795522e93a6010e07da524256c0339720e6d1c

and then

sudo tic -xe alacritty,alacritty-direct extra/alacritty.info
exec zsh
export TERM=alacritty-direct

... and even still using the non-pro dracula colors (and that barebones config in the beginning comment) works properly

@bigpick
Copy link
Collaborator

bigpick commented Jul 22, 2021

Well doh -_- I never uploaded the cursor line to the themes file...:

# ....
ZSH_HIGHLIGHT_STYLES[cursor]='standout'

@bigpick
Copy link
Collaborator

bigpick commented Jul 22, 2021

I merged the code (and it auto-closed this bc the cross-reference); I'll wait to close this until you confirm that getting the latest fixes the issue.

Thanks! (And sorry about all this)

@bagnaram
Copy link
Author

bagnaram commented Jul 23, 2021

Thankyou again for the responsiveness to this obscure issue. I don't think you should need to define that since it gets inherited with that value in https://github.com/zsh-users/zsh-syntax-highlighting/blob/dffe304567c86f06bf1be0fce200077504e79783/highlighters/cursor/cursor-highlighter.zsh#L32

I need to get to the bottom of this issue with standout but I have been able to programmatically reproduce it under certain colors.

on=$(tput smso)"clear"`fb=3;r=255;g=85;b=85;printf '\e[0;%s8;2;%s;%s;%sm ON ' "$fb" "$r" "$g" "$b"`$(tput rmso)$(tput sgr0)
off=clear`fb=3;r=255;g=85;b=85;printf '\e[0;%s8;2;%s;%s;%sm OFF ' "$fb" "$r" "$g" "$b"`$(tput sgr0)
echo $off $on

grim-2021-07-22_23-07-1627012989

I am replicating the token not found color to demonstrate the standout is making no difference here

@bigpick
Copy link
Collaborator

bigpick commented Jul 23, 2021

Hmph. Can you post the output of your current

infocmp alacritty-direct

for comparison, too? Also, you're not also using tmux, right?

@bigpick
Copy link
Collaborator

bigpick commented Jul 23, 2021

Looked some more into this last night and this morning, and interestingly enough this really old issue seems to be exactly what's going on, right?:

alacritty's default behavior is to reverse the foreground and background colors for the current cursor (unless custom_cursor_colors is set). This usually works quite well, except in the case where the cursor is over a character that is already reversed. Consider, for example, the case where you are highlighting text in tmux (^[, move to some text, v to visually highlight). tmux will reverse all selected characters (including the current cursors position). alacritty will then reverse the color again. Depending on your particular color configuration, the cursor essentially disappears.

... but that was since covered; recent issues discuss things like

If the contrast is too low, Alacritty will use inversion though. If that doesn't provide sufficient contrast, there's something wrong with your colors.

so maybe alacritty is doing something bad based on the Dracula Pro colors? But if that was the case, I would have figured that when you switched to using the non-pro configuration for alacritty, things would have worked fine

@bagnaram
Copy link
Author

bagnaram commented Jul 23, 2021

Not using tmux or screen

#	Reconstructed via infocmp from file: /usr/share/terminfo/a/alacritty-direct
alacritty-direct|alacritty with direct color indexing,
	am, bce, hs, mc5i, mir, msgr, npc, xenl,
	colors#0x1000000, cols#80, it#8, lines#24, pairs#0x10000,
	acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
	bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
	clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=\r,
	csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
	cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C,
	cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
	cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m,
	dl=\E[%p1%dM, dl1=\E[M, dsl=\E]2;\007, ech=\E[%p1%dX,
	ed=\E[J, el=\E[K, el1=\E[1K, flash=\E[?5h$<100/>\E[?5l,
	fsl=^G, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH,
	ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\n,
	indn=\E[%p1%dS, invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>,
	kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~,
	kLFT=\E[1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C,
	kb2=\EOE, kbs=^?, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB,
	kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kend=\EOF, kent=\EOM,
	kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~,
	kf13=\E[1;2P, kf14=\E[1;2Q, kf15=\E[1;2R, kf16=\E[1;2S,
	kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, kf2=\EOQ,
	kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~,
	kf23=\E[23;2~, kf24=\E[24;2~, kf25=\E[1;5P, kf26=\E[1;5Q,
	kf27=\E[1;5R, kf28=\E[1;5S, kf29=\E[15;5~, kf3=\EOR,
	kf30=\E[17;5~, kf31=\E[18;5~, kf32=\E[19;5~,
	kf33=\E[20;5~, kf34=\E[21;5~, kf35=\E[23;5~,
	kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q, kf39=\E[1;6R,
	kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~, kf42=\E[17;6~,
	kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~,
	kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~,
	kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q, kf51=\E[1;3R,
	kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~,
	kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~,
	kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~,
	kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~,
	kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~,
	kind=\E[1;2B, kmous=\E[<, knp=\E[6~, kpp=\E[5~,
	kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El,
	memu=\Em, op=\E[39;49m, rc=\E8, rep=%p1%c\E[%p2%{1}%-%db,
	rev=\E[7m, ri=\EM, rin=\E[%p1%dT, ritm=\E[23m, rmacs=\E(B,
	rmam=\E[?7l, rmcup=\E[?1049l\E[23;0;0t, rmir=\E[4l,
	rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m, rmul=\E[24m,
	rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7,
	setab=\E[%?%p1%{8}%<%t4%p1%d%e48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%d%;m,
	setaf=\E[%?%p1%{8}%<%t3%p1%d%e38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%d%;m,
	sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
	sgr0=\E(B\E[m, sitm=\E[3m, smacs=\E(0, smam=\E[?7h,
	smcup=\E[?1049h\E[22;0;0t, smir=\E[4h, smkx=\E[?1h\E=,
	smm=\E[?1034h, smso=\E[7m, smul=\E[4m, tbc=\E[3g,
	tsl=\E]2;, u6=\E[%i%d;%dR, u7=\E[6n,
	u8=\E[?%[;0123456789]c, u9=\E[c, vpa=\E[%i%p1%dd,

That issue looks like a similar problem although the reversal appears to only be disabled under certain color combinations. Like the contrasting issue you referenced. What happens when you run the above snippet?

@bagnaram
Copy link
Author

alacritty/alacritty#4564 seems to be it

@bigpick
Copy link
Collaborator

bigpick commented Jul 23, 2021

Screen Shot 2021-07-23 at 9 46 32 AM

But yeah, I agree, it does seem to be an issue with whatever logic alacritty does with their own implemented reverse-color-at-cursor logic + the current color contrasts.

If the contrast is too low, Alacritty will use inversion though

@bagnaram
Copy link
Author

Thanks for digging. We are safe to close this since it is an implementation issue in the terminal.

@bigpick
Copy link
Collaborator

bigpick commented Jul 23, 2021

OK - sorry to hear things aren't working for you:\

BTW - If I ever get around to buying pro (no hate, just not really for me) I'll look back into this when I actually have the colors and am able to make a compliant set of "pro" versions.

@bigpick bigpick closed this as completed Jul 23, 2021
@swi2012
Copy link

swi2012 commented Nov 30, 2021

I have the same issue with cursor in tilix (in gnome term too, just for check). Setting ZSH_HIGHLIGHT_STYLES[cursor]='fg=#ffffff' fix this for me.

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

Successfully merging a pull request may close this issue.

3 participants