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 zero-width character rendering #1318

Closed
wants to merge 3 commits into from
Closed

fix zero-width character rendering #1318

wants to merge 3 commits into from

Conversation

doy
Copy link

@doy doy commented May 19, 2018

this adds support at the terminal representation level for zero-width characters, which should make zero-width characters not destroy the rendering of ncurses apps, for instance. it also includes a refactoring to support storing multiple codepoints in a single cell - it only renders a single one for now, but it should be a small first step towards #306.

This fixes #1317.

@doy doy changed the title Unicode fix zero-width character rendering May 19, 2018
@chrisduerr
Copy link
Member

Thanks for opening this PR and sorry for not commenting on it at all for so long. I've taken a quick look at it and have noticed that the main change here is that each cell is now a SmallVec<char>.

I can see potential issues in performance and memory usage with this approach, would you be willing to run a few benchmarks on this PR @doy? Using the https://github.com/jwilm/vtebench project it should be simple to get some rough performance numbers.

If there are no big performance or memory issues, I'll take a closer look at the actual code and we'll hopefully be able to get this merged quickly. Thanks again for your work, this has been a long standing issue and I'm really looking forward to a solution.

doy added 2 commits June 21, 2018 09:38
they don't actually yet, but this shifts around the types to make it
possible
@chrisduerr
Copy link
Member

I've benchmarked this myself and it turns out that it introduces a 43% performance decrease compared to the latest master.

@nixpulvis
Copy link
Contributor

I'm curious how that looks without the SmallVec.

@chrisduerr
Copy link
Member

@nixpulvis This uses SmallVec to store more than one cell. So without the SmallVec it would look the same as the current master.

I'd assume that when replacing SmallVec with Vec, that it would just make these issues worse.

@nixpulvis
Copy link
Contributor

I should have been more clear. My curiousity is specifically if there's some weird reason smallvec is slower. But I'm guessing that's not the issue here.

@chrisduerr
Copy link
Member

I'm not sure @nixpulvis, the best way to figure out the exact reason is probably just by running it through perf. But there are a lot of .clone()s, which always looks suspicious, so that might be part of the reason.

chrisduerr added a commit to chrisduerr/alacritty that referenced this pull request Dec 8, 2018
Instead of rendering zero-width characters as full characters, they are
now properly rendered without advancing the cursor.

Because of performance limitations, this implementation only supports up
to 5 zero-width characters per cell. However, as a result of this
limitation there should not be any performance impact.

This fixes alacritty#1317, fixes alacritty#696 and closes alacritty#1318.
@chrisduerr
Copy link
Member

Thanks for your initial pathfinding work, however the performance problems with this approach make it infeasible to merge it. As a result this PR has been created as a more performant replacement.

@chrisduerr chrisduerr closed this Dec 8, 2018
@doy
Copy link
Author

doy commented Dec 8, 2018

great! sorry for not getting around to coming back to this/:

@chrisduerr
Copy link
Member

No worries! Thanks for working on this and getting the ball rolling!

chrisduerr added a commit that referenced this pull request Dec 9, 2018
Instead of rendering zero-width characters as full characters, they are
now properly rendered without advancing the cursor.

Because of performance limitations, this implementation only supports up
to 5 zero-width characters per cell. However, as a result of this
limitation there should not be any performance impact.

This fixes #1317, fixes #696 and closes #1318.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Render zero-width characters without progressing the cursor
3 participants