coteditor / CotEditor

Lightweight Plain-Text Editor for macOS
https://coteditor.com
Other
6.49k stars 432 forks source link

JetBrains Mono arrow rendering when wrapping lines #1741

Closed HCui91 closed 1 month ago

HCui91 commented 1 month ago

Description

CotEditor seemed to separate "-" and ">" when wrapping lines. For fonts like JetBrains Mono, it would render -> as a whole. Therefore, the arrow is not rendered and it left a single > on the second line.

To Reproduce

  1. Set monospaced font to JetBrains Mono Regular (I used 12 pt)
  2. Write some code with -> in a language using the monospaced font, e.g. C++.
  3. Different behaviour of -> if the line is wrapped. Snipaste_2024-10-08_10-29-11

Expected behavior

Maybe avoid separating -> when changing the line. Did not fix using Format -> Syntaxes -> C++...

CotEditor version

5.0.2 (680)

macOS version

15.0

Additional context

No response

1024jp commented 1 month ago

sample code

const auto short_line = object->auxdata<std::vector<float>>("AuxDataKey")
const auto long_line = a_long_object->auxdata<std::vector<float>>("AuxDataKeyLongLongLong")
const auto long_line = a_long_object
    ->auxdata<std::vector<float>>("AuxDataKeyLongLongLong")
1024jp commented 1 month ago

Thank you for the report.

However, according to my investigation, it seems to be an issue on the JetBrains front side (or TextKit-side). For instance, Fira Code, another font for coding with symbol ligatures, renders as expected in the current CotEditor.

Screenshot 2024-10-13 at 11 31 55

I also looked for a workaround for JetBrains Mono but couldn't find an efficient way to avoid line breaking only for ligatured glyphs.