HighlightedTextEditor icon indicating copy to clipboard operation
HighlightedTextEditor copied to clipboard

Respect the current formatting for new text entry

Open jbmorley opened this issue 1 year ago • 1 comments

I've been seeing text jumping during typing after applying formatting with different font sizes. Reproducing this is a little fiddly, but seems to stem from the fact that the typing attributes don't reliably pick up the style from the underlying NSAttributedString.

This change explicitly sets the typing attributes to match the attributes at the insertion point, failing over to the default editor font if the editor is empty.

jbmorley avatar Jun 13 '24 22:06 jbmorley

Here's the behavior I've been seeing (thanks to @gingerbeardman for the bug report and video):

https://github.com/kyle-n/HighlightedTextEditor/assets/220887/cf468c1a-01cb-4002-97af-668ba4ab5309

jbmorley avatar Jun 13 '24 22:06 jbmorley