buffer: show control char visualizers in yellow#378
Merged
Conversation
lhecker
reviewed
May 30, 2025
src/buffer/mod.rs
Outdated
Comment on lines
+1659
to
+1662
| let cursor_visualizer = self.cursor_move_to_offset_internal( | ||
| cursor_beg, | ||
| global_off + chunk_off - 1, | ||
| ); |
Member
There was a problem hiding this comment.
This is accidentally quadratic, because it always starts from cursor_beg again. I'd do either of these two things:
- We split the while loop into two, where one only handles tabs and the other handles all other control chars. Then we only do 2 (?)
cursor_move_to_offset_internalcalls to get the start and end of the control char range and highlight that entire block. - We copy
cursor_beginto amut cursor_visualizervariable above and then use it to iterate over these chars viacursor_visualizer = self.cursor_move_to_offset_internal(cursor_visualizer, ...).
I think the first option would be more ideal, but I think we can just go with the 2nd option for now.
Member
Author
There was a problem hiding this comment.
Ah, yes, I am not comfortable enough with the code to do the first option.
Member
Author
There was a problem hiding this comment.
Therefore, I did the second!
lhecker
approved these changes
Jun 4, 2025
Lou32Verbose
pushed a commit
to Lou32Verbose/edit
that referenced
this pull request
Jan 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This may be controversial, because it is quite garish.
real U+2400 characters on the left, "visualized" control chars on the right