🔴 Spell driver checks entire buffer on every debounce #4

Open xenolandscapes.com
Open opened by xenolandscapes.com

Summary #

src/cursed/spell/driver.lua _check now iterates all lines instead of visible window, causing massive performance regression on large files.

The Problem #

Previously _check only spelled the visible range [top_li, bottom_li] to limit subprocess traffic. The refactoring removed this bounded loop and now sends every line of the buffer to enchant on each 350ms debounce. For a 40k-line file this means 40k enchant queries per idle cycle, which can saturate the proc lane and cause multi-second freezes.

Impact #

  • performance: Every debounce spells the entire buffer regardless of viewport, overwhelming the enchant subprocess and the proc lane.
  • correctness: Spell squiggles now paint correctly off-screen, but at prohibitive cost.

Restore the visible-window check by using the view's scroll position. In driver:_check, compute top_li and bottom_li from the editor's current view (as before) and only iterate those lines. The old mask module was removed; just iterate the visible window at full line text.

References #

b5d15868..335f21a5

Sign up or Sign in to add to the discussion.