On Saturday, November 2, 2024 at 9:34:18 AM UTC-5 Edward K. Ream wrote:

> To colorize each line, the colorizer will use this new main loop:


I forgot that the new main loop must update the QSyntaxHighlighter state!
Like this:

def newMainLoop(self, n: int, s: str) -> None:
    """Colorize a *single* line s, starting in state n."""

    # colorize_line line "s".
    state = self.new_mode_module.colorize_line(s, n)

    # Set the state for QSyntaxHighlighter!
    n = self.computeState(f=None, state=state)
    self.setState(n)

*Discussion*

In the old world, updating the QSyntaxHighlighter state happens deep within
the bowels of the pattern matchers, that is, within the so-called "restart"
methods. The old main loop must *not *update the state explicitly!

In contrast, the new main loop *must *update the QSyntaxHighlighter state.
The new scheme should be significantly easier to understand and debug.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS2wrB9PCPZkDRnMDSM%2BTYnX44Zzx06xsrt1-Xp-Mqm1Lw%40mail.gmail.com.

Reply via email to