-
Notifications
You must be signed in to change notification settings - Fork 149
Description
Description:
Currently, our formatters require zero-width spaces so that they can apply styles (such as header, blockquote, list) to an empty range of text.
The problem with adding these characters is that we must remove them too, once they're no longer necessary. This has not been the case so far.
We need to remove the need to have those characters inserted to begin with.
Details:
Some research has shown that modifying the typing attributes has an impact on how the text view lays out its contents. This is the direction that should enable us to draw blockquotes, lists, etc without really adding any content.
The problem with this approach is that NSLayoutManager does not have access to the typingAttributes of its parent UITextView.
There are some hints online that these attributes are actually accessible through a private property. Search for typingAttributes in these NextStep sources.
Proposal:
- Make sure styles are applied to typingAttributes whenever the line is empty (if there's a newline character, the line is NOT empty).
- Consider drawing the bullet items for lists in
TextViewinstead ofLayoutManager. - Make sure whenever a formatter enables or disables a style, the line where the caret is placed is redrawn (we probably need to redraw al involved lines when there's a selection instead of a caret).
- Remove zero-width space markers everywhere.
Child issues:
- Nuke ZeroWidth Space from HeaderFormatter - Remove zero-width spaces for HEADER styles. #419.
- Nuke ZeroWidth Space from PreFormatter - Remove zero-width spaces for PRE style. #420.
- Nuke ZeroWidth Space from TextList - Remove zero-width spaces for lists. #421.
- Nuke ZeroWidth Space from BlockquoteFormatter - Remove zero-width spaces for blockquotes. #422.