[READ-ONLY] Mirror of https://github.com/bombshell-dev/tty. Platform independent 2D layout engine for terminal applications based on Clay
5

Configure Feed

Select the types of activity you want to include in your feed.

fix: collapse orphaned wide-char lead on trailing-column overlay

When a narrow glyph is floated onto the trailing column of an
already-placed wide char, the present loops skipped the trailing
column and the overlay was dropped (the wide char painted over both
cells). Detect the partial overwrite (non-space trailing cell) and
collapse the orphaned lead to a space at width 1 so the overlay glyph
emits. Applied symmetrically to present_cups and present_lines; rows
without overlapping writes stay byte-for-byte identical.

Fixes #75

Nate Moore (Jun 5, 2026, 1:14 AM -0500) 7ebeb93b 352cb27b

+30
+30
src/clayterm.c
··· 176 176 if (w < 1) 177 177 w = 1; 178 178 179 + /* If a narrow glyph was floated onto a trailing column of this wide 180 + * char, render_text left the lead cell but the trailing cell now 181 + * holds a non-space glyph. Collapse the orphaned lead to a space and 182 + * treat it as width-1 so the overlay glyph emits on the next pass. */ 183 + if (w > 1) { 184 + for (int i = 1; i < w && x + i < ct->w; i++) { 185 + Cell *bw = cell_at(ct, ct->back, x + i, y); 186 + if (bw->ch != ' ') { 187 + back->ch = ' '; 188 + w = 1; 189 + break; 190 + } 191 + } 192 + } 193 + 179 194 if (cell_cmp(back, front)) { 180 195 /* copy to front */ 181 196 *front = *back; ··· 221 236 int w = wcwidth(back->ch); 222 237 if (w < 1) 223 238 w = 1; 239 + 240 + /* If a narrow glyph was floated onto a trailing column of this wide 241 + * char, render_text left the lead cell but the trailing cell now 242 + * holds a non-space glyph. Collapse the orphaned lead to a space and 243 + * treat it as width-1 so the overlay glyph emits on the next pass. */ 244 + if (w > 1) { 245 + for (int i = 1; i < w && x + i < ct->w; i++) { 246 + Cell *bw = cell_at(ct, ct->back, x + i, y); 247 + if (bw->ch != ' ') { 248 + back->ch = ' '; 249 + w = 1; 250 + break; 251 + } 252 + } 253 + } 224 254 225 255 *front = *back; 226 256