Draw Invisible Characters #334
Merged
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.
Description
Adds a configuration option to draw invisible characters.
By default, draws spaces as a small dot, with emphasis on spaces that align with the user's selected indent width. Draws tabs as a small arrow. Draws line endings (carriage returns and line feeds) as a
¬character.Replacement characters are configurable using the config object.
Adds a configuration option to warn users about potentially dangerous/unnecessary characters that may not be visible to the naked eye. This could be used to warn about something like a zero-width space being accidentally copied into a file.
Detailed changes
InvisibleCharactersConfigtype that contains toggles for certain whitespace characters, as well as a set of 'warning' characters to draw warning boxes on.InvisibleCharactersCoordinatorthat tells the text view how to draw characters depending on the current configuration.invisibleCharacterConfigoption toCodeEditSourceEditorandTextViewController.warningCharactersoption toCodeEditSourceEditorandTextViewController.TextViewControllerto correctly update the coordinator when the user's theme, font, or indent option are updated.Related Issues
Checklist
Screenshots
Example document with tabs, spaces, newlines, and a zero-width character pasted in before the
1. It responds to theme updates and live editing.Screen.Recording.2025-06-12.at.1.27.39.PM.mov