helix icon indicating copy to clipboard operation
helix copied to clipboard

Visible whitespace only for selections

Open tomKPZ opened this issue 2 years ago • 3 comments

tomKPZ avatar Apr 21 '22 03:04 tomKPZ

This is my first foray into rust so the code may not be idomatic

tomKPZ avatar Apr 21 '22 03:04 tomKPZ

I'm not sure this makes sense or if it's too much of a micro optimization but we could not emit selection events when none of the WhitespaceRenderValues are for select. What do you think?

the-mikedavis avatar Aug 08 '22 23:08 the-mikedavis

I'm not sure this makes sense or if it's too much of a micro optimization but we could not emit selection events when none of the WhitespaceRenderValues are for select. What do you think?

Sure, done in latest revision

tomKPZ avatar Aug 09 '22 00:08 tomKPZ

It looks like whitespace ends up not getting rendered for the cursor. For that we may need to include ui.cursor and ui.cursor.* (but there's also ui.cursorline so we can't use a starts-with check)

the-mikedavis avatar Aug 17 '22 01:08 the-mikedavis

I've done some simplifications, this way we can avoid comparing spans against the set of selection scopes in most cases. I'm also thinking if we want to remove that render closure for a regular function

archseer avatar Aug 17 '22 05:08 archseer

Thanks for the commits @archseer !

I've added a fix for ui.cursor that @the-mikedavis found, and I've removed the inner render_whitespace closure, so no more dynamic dispatch is required for each whitespace char rendered.

tomKPZ avatar Aug 17 '22 16:08 tomKPZ

With #5420 merged this PR will need to be ported to the new text rendering in ui/document.rs

pascalkuthe avatar Feb 01 '23 11:02 pascalkuthe

clsoing this one as stale as the rendering code has been entirely replaced. Thank you for contributing

pascalkuthe avatar Apr 13 '24 23:04 pascalkuthe