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

fix selection rendering of unstyled characters #1250

Merged
merged 1 commit into from
Mar 28, 2022

Conversation

tlinford
Copy link
Contributor

With a basic bash session the character style diffing was not emitting a reset when rendering the first character after the selection. By starting the cursor off with RESET_STYLES, the problem goes away, and have noticed no problems otherwise.

fixes #1208

cc @imsnif

@tlinford tlinford temporarily deployed to cachix March 21, 2022 10:34 Inactive
@tlinford tlinford temporarily deployed to cachix March 21, 2022 10:34 Inactive
@imsnif
Copy link
Member

imsnif commented Mar 21, 2022

I haven't tested this, but I'm not sure this behaviour is correct. Looking at this briefly, it seems that if we have:

Two characters after each other, the first being red and the second being red and bold. This would:

  1. Render the first character as red
  2. Diff the two characters, find that they are both red and so do nothing with the foreground color
  3. Find that the second one is bold, and add bold to the diff

This would then mean that we get a diff with the bold bit turned on and everything else reset. Meaning the second character would only be rendered as bold but not red.

I haven't tested this though, so maybe I'm missing something.

@tlinford
Copy link
Contributor Author

Does not seem to be the case - Otherwise I don't think we would properly handle an 'ESC [ 0 m` sequence?

This is what I get with the example above:
screenshot-2022-03-21T11:26:55

@imsnif
Copy link
Member

imsnif commented Mar 25, 2022

As discussed offline - this change should be safe. I didn't notice it's happening in the Cursor constructor rather than the CharacterStyles constructor. That means it only happens at the first character when clearing a pane (eg. when starting a new pane or moving to an alternate screen).

@tlinford tlinford merged commit 303123f into main Mar 28, 2022
@tlinford tlinford deleted the fix-unstyled-characters-selection-rendering branch March 28, 2022 18:36
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 this pull request may close these issues.

Visual selecting selects to end of row, actual select is correct.
2 participants