HighlightedTextEditor icon indicating copy to clipboard operation
HighlightedTextEditor copied to clipboard

[Markdown] Entering text will jitter after pressing enter in the title

Open iamiota opened this issue 1 year ago • 5 comments

DO NOT DELETE THIS TEMPLATE

If you do not fill out this template, your issue will be automatically closed.

Describe the bug In markdown mode, text input will jitter after pressing enter in the title.

To Reproduce

  1. Input "# aaaaaa"
  2. Press "Enter" and input "aaaaa"
  3. After returning the cursor to "# aaaaaa", press enter, and then enter text

Expected behavior Normally output text in default font

Screenshots If applicable, add screenshots to help explain your problem.

https://github.com/kyle-n/HighlightedTextEditor/assets/7531576/52015b48-5278-4586-9a6b-d052ca3c1652

Environment Please include:

  • macOS 12.7.2
  • AppKit, SwiftUI

Additional context Add any other context about the problem here.

iamiota avatar Jan 17 '24 06:01 iamiota

It is worth mentioning that I also have a similar font size bug when using another markdown editor (SwiftDown). I don’t know if it is because of the system version. I am preparing to upgrade to the latest macos system. After that, I will give feedback.

iamiota avatar Jan 17 '24 09:01 iamiota

The bug still exists in macOS 14.2.1

iamiota avatar Jan 17 '24 11:01 iamiota

Confirmed the bug is happening on macOS 14.2.1.

Code to reproduce:

struct MarkdownEditorA: View {
    @State var text: String = ""

    var body: some View {
        HighlightedTextEditor(text: $text, highlightRules: .markdown)
    }
}

Steps:

  1. Type "a" (without quotes) and press return twice
  2. Type "# b" and press return twice
  3. Type "c"
  4. Use the mouse to move the insertion point to the end of "# b"
  5. Press return once and type "d"
  6. Observe each letter typed starts as big, then resizes to regular size

Not sure what the problem is. Going to see if anyone else is having trouble with NSTextView() on Sonoma.

kyle-n avatar Jan 22 '24 20:01 kyle-n

I am experiencing the same issue on macOS 14.2.1 Sonoma.

envomer avatar Feb 17 '24 19:02 envomer

Reproducible on macOS 14.3.1 as well.

garrettmurray avatar Feb 17 '24 22:02 garrettmurray