mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-30 01:41:43 +00:00
refactor(tui): /clean pass on blitz closeout — trim comments, flatten logic
- normalizeStatusBar collapses to one ternary expression
- /statusbar slash hoists the toggle value and flattens the branch tree
- shift-tab yolo comment reduced to one line
- cursorLayout/offsetFromPosition lose paragraph-length comments
- appLayout collapses the three {!overlay.agents && …} into one fragment
- StatusRule drops redundant flexShrink={0} (Yoga default)
- server.py uses a walrus + frozenset and trims the compat helper
Net -43 LoC. 237 vitest + 46 pytest green, layouts unchanged.
This commit is contained in:
parent
1e8cfa9092
commit
48f2ac3352
8 changed files with 40 additions and 83 deletions
|
|
@ -167,11 +167,8 @@ export function lineNav(s: string, p: number, dir: -1 | 1): null | number {
|
|||
return snapPos(s, Math.min(nextBreak + 1 + col, lineEnd))
|
||||
}
|
||||
|
||||
// Cursor layout mirrors `wrap-ansi(text, cols, { wordWrap: false, hard: true })`
|
||||
// which is what `<Text wrap="wrap-char">` ends up feeding to the renderer.
|
||||
// Char-granularity wrap keeps wrap boundaries deterministic as the user
|
||||
// types — word-wrap's whitespace-preferring reshuffle causes the cursor
|
||||
// to flicker as each keystroke moves a word across a line break (blitz #9).
|
||||
// mirrors wrap-ansi(..., { wordWrap: false, hard: true }) so the declared
|
||||
// cursor lines up with what <Text wrap="wrap-char"> actually renders
|
||||
export function cursorLayout(value: string, cursor: number, cols: number) {
|
||||
const pos = Math.max(0, Math.min(cursor, value.length))
|
||||
const w = Math.max(1, cols)
|
||||
|
|
@ -205,11 +202,7 @@ export function cursorLayout(value: string, cursor: number, cols: number) {
|
|||
col += sw
|
||||
}
|
||||
|
||||
// The cursor renders as an inverted cell AFTER the character at `pos`
|
||||
// (or as a standalone trailing cell when `pos === value.length`). If
|
||||
// col has reached the wrap column, that cell overflows to the next row
|
||||
// — match wrap-ansi's behavior so the declared cursor doesn't sit past
|
||||
// the visual edge.
|
||||
// trailing cursor-cell overflows to the next row at the wrap column
|
||||
if (col >= w) {
|
||||
line++
|
||||
col = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue