From 49b536c434d39d98b718847f00b84bb4eff2d51f Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 7 Jun 2026 11:52:25 -0400 Subject: [PATCH] Toggle order rhyme/alliteration/rhythm; dots persist while typing The rhythm layer now keeps dots over the unchanged prefix of an edited line (same logic as the rhyme fills) instead of blanking the whole line until re-analysis. Co-Authored-By: Claude Opus 4.8 (1M context) --- static/index.html | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/static/index.html b/static/index.html index 91af0cf..52f266c 100644 --- a/static/index.html +++ b/static/index.html @@ -280,8 +280,8 @@ Double-click any word to look it up on the right."> - +
@@ -605,7 +605,17 @@ function renderStress(lines){ let html = ''; lines.forEach((line, i)=>{ const fresh = analysis && analysis.lines[i] === line; - const spans = (fresh ? (byLine[i] || []) : []).slice().sort((a,b)=>a.s-b.s); + let raw = []; + if(fresh){ + raw = byLine[i] || []; + }else if(analysis && typeof analysis.lines[i] === 'string'){ + const old = analysis.lines[i]; + let cp = 0; + const n = Math.min(old.length, line.length); + while(cp < n && old[cp] === line[cp]) cp++; + raw = (byLine[i] || []).filter(s=>s.e <= cp); + } + const spans = raw.slice().sort((a,b)=>a.s-b.s); let pos = 0, h2 = ''; spans.forEach(s=>{ if(s.s < pos) return;