mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 16:14:40 +00:00
Audit follow-ups on the highlight context window: - Blank lines sitting at the very start/end of a `context` tag were passed through untouched when a side was short enough not to be trimmed, so a highlight whose context began or ended with blank lines still rendered empty space above/below the quote. Trim the outer edges of the windowed passage (re-basing the marked range accordingly). - `locate` enumerated every occurrence of the quote — a full context scan plus a list allocation — even in the common no-prefix case where only the first match is needed. Short-circuit to a single indexOf there. - Clamp the returned marked range to the trimmed text length so it can never point past the end (e.g. a quote ending in trimmed whitespace). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ApuEseGcFjUFqYoLhCuR91