Skip to content

Draw Invisible Characters From Configuration #103

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

Merged

Conversation

thecoolwinter
Copy link
Contributor

Description

Adds the ability for developers to pass in an object to determine invisible character drawing.

This is intentionally not doing the character matching and replacement styling in this package. To achieve the flexibility we want, I've raised that to the level of the source editor which can for instance determine if we want to draw a dot with larger emphasis because it's on a tab stop.

Detailed changes:

  • Moved all line fragment drawing to a new object LineFragmentRenderer. Line fragments were increasingly requiring more and more objects to be passed to them. This object centralizes those dependencies into one object.
  • Adds a new InvisibleCharactersDelegate protocol for API consumers to conform to. Consumers can provide a set of characters to match on, and a method to provide a 'style' to draw them with.
  • Makes a slight adjustment to how cursors and line fragment views are added to the view hierarchy.
    • Cursors are now placed at the top of the subview stack, ensuring they're always on top of the content.
    • Line fragments are now placed on the bottom of the subview stack, ensuring they're always drawn under cursors.

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

Fleshed out example with CESE replacing tabs with arrows, spaces with dots, emphasizing a zero-width space (​), and replacing newlines with the (¬) character.

Screenshot 2025-06-10 at 10 55 04 AM

@thecoolwinter thecoolwinter merged commit c045ffc into CodeEditApp:main Jun 13, 2025
2 checks passed
@thecoolwinter thecoolwinter deleted the feat/invisible-characters branch June 13, 2025 16:01
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.

1 participant