mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 23:50:45 +00:00
* perf(keyword-highlight): reduce highlight latency and redundant regex scanning - Split triggerRefresh into two modes: "immediate" (rAF, for new output and rule changes) and "debounced" (setTimeout, for scroll/resize), eliminating the fixed 200ms delay after each write that caused visible highlight lag on commands like `ls`. - Add per-line match result cache (LRU, bounded by cacheEntries config) so repeated or scrolled-back lines skip regex scanning entirely. - Lazily build the string-to-cell column map only when a regex match is actually found, avoiding unnecessary work on non-matching lines. - Clean up animationFrameId and matchCache on dispose/rule change to prevent leaks and stale results. * fix: include cell layout in highlight cache key to prevent misplaced decorations Two IBufferLines can produce identical translateToString() output but differ in cell layout (e.g. empty cells vs real space characters after tab stops). Using lineText alone as the cache key could return cached x/width ranges computed from a different cell layout, producing misplaced or truncated highlights. Build the cellMap eagerly and include it in the cache key so lines with different cell structures get separate cache entries. Pass the pre-built cellMap into scanLine to avoid redundant work. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: panwk <panwukan@suangoo.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>