IgKh / katvan

A bare-bones editor for Typst files, with a bias for Right-to-Left editing
GNU General Public License v3.0
16 stars 2 forks source link

macos/vscode support #4

Open yonatankremer opened 1 week ago

yonatankremer commented 1 week ago

I've been using typst for university for a few months with the vscode extension. Only major issue so far is editing rtl text doesn't seem to be natively supported in vscode. If it is nicer on your app, would love to see a macos version, or some aspects of it as a vscode extension for editing rtl text!

IgKh commented 1 week ago

Hi!

I'll address the VSCode bit first, as it is unclear as to what aspects exactly could be made into an extension. The things that give typing RTL text, especially when interlaced with math notation, "correct" feeling in my opinion and experience are:

  1. Correctly applying the Unicode BiDi algorithm within a single directionality run.
  2. Giving each paragraph / line its "correct" base direction, so different directionality runs in the same line are properly arranged (this is not just aligning RTL paragraphs to the right, in fact visual alignment is the least important aspect of it).
  3. Isolating sequences of math (which consists of mostly characters with nuetral directionality according to the Unicode standard) into a separate directionality run so that surrounding RTL text doesn't "bleed in".
  4. Logical cursor movements, so arrow keys and keys like Home and End work as expected regardless of the directionality run the cursor is placed on.

All of those are things that the text layout engine which lies at the base of the editor have to support. (1) and (4) are typically obtained "for free" from any underlying infrastructure written in this century, but (2) and (3) - not so much, and code editors typically don't want the tradeoffs involved. This is true in particular for Monaco (VSCode's text editor control), with its' developers stating it as a non-goal. I really don't think something like that can be taped over with an extension, and everything else doesn't really matter if the basic feel isn't there.

As for macOS support, I don't own a Mac nor have continuous access to one, so I personally don't need a macOS port and can't really develop one. Qt does support macOS natively, and Katvan doesn't use any platform specific libraries, so in theory it should compile and run as-is on macOS. The integration of it will likely be somewhat poor (things like file associations, dock icon, menu arrangement, spell checking dictionary locations, etc need some work to get right). If you'd like, please try building it and see if it does build, and if the experience is tolerable for you.

Thanks!