Visible ranges and replacement decorations

When using a MatchDecorator to match and replace a large chunk of text, subsequent matches in the document are not replaced because the content is outside the visible range.

Example scenario:

  1. Configure the view to show as a single line text box.
  2. Use a MatchDecorator to replace the first 5,000 digits of pi with PI.
  3. Paste the pattern into the text box twice.
  4. The editor may show something like PI 3.1 because everything after the 3.1 is outside the calculated visible range.

Should the visible range be recalculated after decoration replacements and then have the matchers run again? Or should the MatchDecorator be configurable to run against the entire doc instead of just the visible range?

Used a plugin to replace the long chunks of text with unique ids that the match decorator looks for. Then replace the ids with the original text when the document content is saved by the app or placed on the clipboard by cut or copy.

For replacement decorations of this size (and any replacement that goes across line boundaries), you will want to use a state field, not a view plugin. View plugins may depend on the viewport, and thus they shouldn’t do anything that is going to affect the viewport.