Renderers: linear per-row measuring in ImGui; one tab width; Qt drawing fixes
ImGui measured every span, highlight and the cursor from column 0 of the line (and rescanned the line for each column conversion), which is quadratic in line length on minified files. Columns now come from one table per line and pixel offsets from the nearest position already measured. Output is pixel-identical to before (compared under Xvfb, with syntax colouring, tabs, UTF-8 and search highlights). kte::kTabWidth replaces the literal 8s, and Qt's 4: Qt expanded tabs to 4 columns while the command layer scrolled by 8, misplacing the cursor and horizontal scroll on lines with tabs. MeasureChar and DisplayColumns (TermWidth.h) are the command layer's column model, now shared, and Qt draws by it instead of one column per byte, which shifted everything after a multi-byte character. Qt also: - drew operators in the dark-mode background colour, so they vanished; - computed the editor's column count three ways (different glyph, padding and status-row accounting) from painting, and positioned text with a rounded cell width, so the cursor drifted off the glyphs on long lines. One TextLayout now serves painting, resizing, font changes and wheel scrolling, with a fractional cell width; runs are drawn only where visible; - drew each non-ASCII character at its cell, since a fallback-font glyph wider than a cell pushed the rest of the run out of place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB
This commit is contained in:
+1
-1
@@ -281,7 +281,7 @@ SyntaxInk(const TokenKind k)
|
||||
case TokenKind::Function:
|
||||
return dark ? RGBA(0x88C0D0) : RGBA(0x3465A4);
|
||||
case TokenKind::Operator:
|
||||
return dark ? RGBA(0x2E3440) : RGBA(0x2E3440);
|
||||
return dark ? RGBA(0xECEFF4) : RGBA(0x2E3440); // as the ImGui palette
|
||||
case TokenKind::Punctuation:
|
||||
return dark ? RGBA(0xECEFF4) : RGBA(0x2E3440);
|
||||
case TokenKind::Identifier:
|
||||
|
||||
Reference in New Issue
Block a user