v0.7.0: char-width + status bar fix — TDD (RED→GREEN)

char-width: contract 5, 4 tests (6 assertions), 100% pass
  ASCII=1, CJK/Hangul/Kana/halfwidth=2, combining marks=0, tab=8
  Pure Lisp, ~25 lines, no deps. Used by word-wrap for unicode.

status bar: contract 6, timestamp right-aligned at (- w 12)
  Fixes overlap where focus map and timestamp both drew at :y 2 :x 1
This commit is contained in:
2026-05-08 10:54:27 -04:00
parent ce715b599c
commit c8964d0249
7 changed files with 96 additions and 490 deletions

View File

@@ -10,9 +10,6 @@ All state mutation flows through event handlers in the controller.
1. (init-state): returns a fresh state plist with ~:msgs~ list,
~:input~ buffer, ~:dirty~ flag, ~:busy~ flag, and ~:connection~ status.
v0.7.0: ~:scroll-at-bottom~ flag tracks whether the user is scrolled to
the bottom. ~add-msg~ sets ~:scroll-notify~ t when a new message arrives
and the user is scrolled up.
2. (add-msg role content &key gate-trace): appends a message object
to the ~:messages~ vector (v0.3.3), tagged with timestamp, role,
and optional gate-trace from the daemon (v0.4.0).
@@ -135,8 +132,6 @@ See *tui-theme-presets* for named presets (dark, light, solarized, gruvbox).")
:input-buffer nil :input-history nil :input-hpos 0
:messages (make-array 16 :adjustable t :fill-pointer 0)
:scroll-offset 0 :busy nil :cursor-pos 0
:pending-ctrl-x nil :scroll-at-bottom t
:scroll-notify nil)
:dirty (list nil nil nil))))
#+end_src
@@ -171,9 +166,6 @@ See *tui-theme-presets* for named presets (dark, light, solarized, gruvbox).")
(defun add-msg (role content &key gate-trace)
(vector-push-extend (list :role role :content content :time (now) :gate-trace gate-trace) (st :messages))
;; v0.7.0: if scrolled up, set notification flag
(unless (st :scroll-at-bottom)
(setf (st :scroll-notify) t))
(setf (st :dirty) (list t t nil)))
#+end_src