AvaloniaEdit icon indicating copy to clipboard operation
AvaloniaEdit copied to clipboard

Generator support for long lines

Open mattj23 opened this issue 2 years ago • 2 comments

Commit ccc8f66b, part of PR #172, categorically disabled all generators for long lines.

I understand the issues which lead to that pull request, but would we be open to finding a reasonable way to allow certain generators to run on long lines? I'm working on a markdown editor and it isn't uncommon to have prose with lines that long.

Some ways it might be possible to allow client code to opt into allowing a generator to avoid being disabled:

  • A flag property on the generator itself returning a static true or false
  • An attribute added to the generator which allows it to skip the check
  • A registration object of some sort where generators can be registered to be allowed to skip the length check

Thoughts? I'm happy to make the enhancement and submit a PR.

mattj23 avatar Apr 02 '22 05:04 mattj23

Long term we need horizontal virtualization of text lines so this performance hit can entirly be avoided. At the moment Avalon(ia)Edit is processing a line up until it reaches a mandatory break. This needs to be changed to only process text until we reach off screen and start processing portions of the text on demand when the current viewport changes.

It should be possible to make disabling the generators for long lines an option instead of disableing them all the time.

Gillibald avatar Apr 02 '22 08:04 Gillibald

Hey @mattj23,

It should be possible to make disabling the generators for long lines an option instead of disabling them all the time.

Yes, what about setting up a couple of options in TextEditorOptions?:

  • DisableGeneratorsForLongLines (true by default)
  • LongLineLength (3000 by default)

About this:

I'm working on a markdown editor and it isn't uncommon to have prose with lines that long.

I have a side question about it: https://github.com/AvaloniaUI/AvaloniaEdit/discussions/224

danipen avatar Apr 02 '22 10:04 danipen