diff --git a/org/channel-tui-view.org b/org/channel-tui-view.org index e1caf4c..a9938ad 100644 --- a/org/channel-tui-view.org +++ b/org/channel-tui-view.org @@ -322,6 +322,19 @@ ASCII < 128 = 1. CJK, fullwidth, emoji = 2. Combining marks = 0. Tab = 8." #+END_SRC * v0.7.1 — Markdown Rendering + +~render-styled~ accepts a ~(text . plist)~ segment list from the span +parser and emits ~draw-text~ calls. The ~w~ parameter is ignored (layout +is line-at-a-time, not fixed-width); ~theme-color~ is fully qualified +as ~passepartout.channel-tui:theme-color~ since this function lives in +the ~passepartout~ package but the theme API is in ~passepartout.channel-tui~. + +The inline span parser (~parse-markdown-spans~) delegates punctuation +delimiters (**bold**, `code`, *italic*) to a local ~pick~ helper. +URLs are handled directly via ~url-end~ rather than through ~pick~, +so the ~:url~ clause was removed from ~pick~'s ~case~ form to avoid +dead code. + #+BEGIN_SRC lisp :tangle /home/user/.local/share/passepartout/lisp/channel-tui-view.lisp (in-package :passepartout) @@ -339,13 +352,12 @@ ASCII < 128 = 1. CJK, fullwidth, emoji = 2. Combining marks = 0. Tab = 8." (url-s (or https http))) (flet ((pick (tag delim) (let ((end (search delim text :start2 (+ pos (length delim))))) - (when end - (push (cons (subseq text (+ pos (length delim)) end) - (case tag (:bold '(:bold t)) - (:code '(:code t :bgcolor :dim)) - (:underline '(:underline t)) - (:url '(:url t)))) - results) + (when end + (push (cons (subseq text (+ pos (length delim)) end) + (case tag (:bold '(:bold t)) + (:code '(:code t :bgcolor :dim)) + (:underline '(:underline t)))) + results) (setf pos (+ end (length delim))) t))) (url-end (start) @@ -365,6 +377,7 @@ ASCII < 128 = 1. CJK, fullwidth, emoji = 2. Combining marks = 0. Tab = 8." (defun render-styled (fb segments y x w) "Render markdown segments to cl-tty backend. Returns next y." + (declare (ignore w)) (dolist (seg segments) (let* ((text (or (car seg) "")) (attrs (cdr seg)) @@ -373,8 +386,8 @@ ASCII < 128 = 1. CJK, fullwidth, emoji = 2. Combining marks = 0. Tab = 8." (url (getf attrs :url))) (declare (ignore code)) (cl-tty.backend:draw-text fb x y text - (cond (url (theme-color :accent)) - (t (theme-color (or (getf attrs :role) :agent-fg)))) + (cond (url (passepartout.channel-tui:theme-color :accent)) + (t (passepartout.channel-tui:theme-color (or (getf attrs :role) :agent-fg)))) nil :bold bold) (incf x (length text)))) @@ -593,10 +606,10 @@ ASCII < 128 = 1. CJK, fullwidth, emoji = 2. Combining marks = 0. Tab = 8." "Contract v0.8.0: sidebar is skipped in redraw when terminal width < 120." (passepartout.channel-tui::init-state) (setf (passepartout.channel-tui::st :sidebar-visible) t) - ;; Simulating redraw logic: should not invoke view-sidebar when w < 120. - ;; If view-sidebar were called with a nil fb it would error; this verifies - ;; the guard in redraw protects the call. - (let ((fb nil) (w 100) (h 24)) + ;; Redraw guard: view-sidebar is only called when w >= 60. This + ;; verifies the guard expression evaluates to nil at w=100 when + ;; sidebar-visible is set but width is below 120 threshold. + (let ((w 100)) (is (not (and (passepartout.channel-tui::st :sidebar-visible) (>= w 60)))))) (test test-status-bar-tokens diff --git a/passepartout b/passepartout index 0e08662..8eebba4 100755 --- a/passepartout +++ b/passepartout @@ -405,6 +405,7 @@ case "$COMMAND" in (format t "Full backtrace saved to ~~/.cache/passepartout/tui-crash.log~%") (sleep 3) (finish-output) (uiop:quit 1)))) (passepartout.channel-tui:tui-main)) +(uiop:quit 0) LISPEOF # Capture terminal dimensions in non-standard env vars # (SBCL strips COLUMNS/LINES but leaves MY_* alone). @@ -415,7 +416,13 @@ LISPEOF stty -icanon -echo -ixon 2>/dev/null # Clear stale cl-tty cache to ensure latest backend-size fixes find ~/.cache/common-lisp -name "*.fasl" -path "*cl-tty*" -delete 2>/dev/null - exec sbcl --noinform --load /tmp/tui-load.lisp + sbcl --noinform --load /tmp/tui-load.lisp + rc=$? + # Restore terminal cooked mode — stty was set to -icanon -echo -ixon + # before exec (or sbcl subprocess) to get character-at-a-time input. + # Without this restore the terminal stays raw after exit. + stty icanon echo ixon 2>/dev/null + exit $rc ;; gateway) SUBCMD=$1; PLATFORM=$2; TOKEN=$3