bruiken / Notepad--

Notepad--, a lightweight web based editor with numerous optional features.
MIT License
3 stars 0 forks source link

Implement more efficient syntax highlighting by only updating when needed #5

Closed jwijenbergh closed 3 years ago

jwijenbergh commented 3 years ago

Right now we're updating the highlighting on every key press (or after when a request was already being processed).

A more efficient way would be to update it on e.g. every new word added. We would thus need to do the following:

  1. Update the html tree with the added text at the exact cursor point (this means that when a full word hasn't been completed yet, it will simply be the normal color but the code that was already added is still highlighted)
  2. Send the updated text to the syntax highlighter in python after a new word has been added

Nr 1. is the culprit here, need to find good practices how to do this

bruiken commented 3 years ago

Another idea: when creating non-highlighted text, put this in another absolute-positioned element in between the highlighted text and the typed text. This can serve as the buffer between highlighting and typing.

jwijenbergh commented 3 years ago

No clue how to do this at the moment (without making it way too complicated in the process).

jwijenbergh commented 3 years ago

I think this feature is simply too difficult to implement efficiently. Should we close this? @bornobob

bruiken commented 3 years ago

Agreed