v0.8.0: tangle to XDG (~/.local/share/cl-tty/), remove stale memex .lisp files
This commit is contained in:
@@ -43,7 +43,7 @@ The test package exports ~run-tests~ so it can be invoked from the
|
||||
top-level test runner. ~fiveam~ imports directly for declarative
|
||||
~test~ and ~is~ forms. The ~box-suite~ collects all box/text tests.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(defpackage :cl-tty-box-test
|
||||
(:use :cl :fiveam :cl-tty.backend :cl-tty.layout :cl-tty.box)
|
||||
(:export #:run-tests))
|
||||
@@ -59,7 +59,7 @@ top-level test runner. ~fiveam~ imports directly for declarative
|
||||
~run-all-tests.lisp~. It runs the ~box-suite~, explains results to
|
||||
stdout, and exits cleanly with ~uiop:quit~.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(defun run-tests ()
|
||||
(let ((result (run 'box-suite)))
|
||||
(fiveam:explain! result)
|
||||
@@ -73,7 +73,7 @@ stdout, and exits cleanly with ~uiop:quit~.
|
||||
actual terminal I/O. Returns the backend and stream as multiple
|
||||
values.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(defun make-capturing-backend ()
|
||||
(let* ((s (make-string-output-stream))
|
||||
(b (make-modern-backend :output-stream s)))
|
||||
@@ -85,7 +85,7 @@ values.
|
||||
Verify that a bare ~make-box~ returns a ~box~ instance and
|
||||
automatically creates a ~layout-node~ through inheritance.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test box-creates-with-defaults
|
||||
"A box created with no arguments has reasonable defaults"
|
||||
(let ((b (make-box)))
|
||||
@@ -98,7 +98,7 @@ automatically creates a ~layout-node~ through inheritance.
|
||||
Verify that a box with ~:border-style :single~ draws the four corner
|
||||
characters (┌ ┐ └ ┘) in the output stream.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test box-renders-border
|
||||
"A box with border draws border characters"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
@@ -117,7 +117,7 @@ characters (┌ ┐ └ ┘) in the output stream.
|
||||
Verify that a box with ~:bg :red~ emits SGR background color codes
|
||||
(41m) in the output stream.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test box-renders-background
|
||||
"A box with background color fills interior"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
@@ -134,7 +134,7 @@ Verify that a box with ~:bg :red~ emits SGR background color codes
|
||||
Verify that a title string appears in the rendered output stream
|
||||
when ~:title~ is provided.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test box-renders-title
|
||||
"A box with title renders the title text"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
@@ -150,7 +150,7 @@ when ~:title~ is provided.
|
||||
Verify that ~:border-style nil~ suppresses corner characters but
|
||||
background fill rendering continues to work.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test box-without-border
|
||||
"A box with border-style nil draws no border"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
@@ -167,7 +167,7 @@ background fill rendering continues to work.
|
||||
Verify that a box with zero width and height produces no output
|
||||
(triggers the early-return guard in ~render-box~).
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test box-zero-size
|
||||
"A box with any zero dimension renders nothing"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
@@ -183,7 +183,7 @@ Verify that a box with zero width and height produces no output
|
||||
Verify that a box with width 1 produces no output — ~draw-border~
|
||||
requires at least 2 columns to draw corner and edge characters.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test box-single-column
|
||||
"A box with width 1 renders nothing (needs min 2 for border)"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
@@ -199,7 +199,7 @@ requires at least 2 columns to draw corner and edge characters.
|
||||
Verify that a 2x2 box (the minimum viable size for border rendering)
|
||||
still produces corner characters in the output.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test box-minimum-size
|
||||
"A box with minimum non-zero size still renders"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
@@ -215,7 +215,7 @@ still produces corner characters in the output.
|
||||
Verify that ~make-text~ with an empty string returns a ~text~
|
||||
instance and creates a ~layout-node~.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test text-creates-with-defaults
|
||||
"A text created with no arguments has reasonable defaults"
|
||||
(let ((txt (make-text "")))
|
||||
@@ -228,7 +228,7 @@ instance and creates a ~layout-node~.
|
||||
Verify that text content appears in the captured output stream after
|
||||
rendering.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test text-renders-content
|
||||
"A text renders its content at position"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
@@ -244,7 +244,7 @@ rendering.
|
||||
Verify that an empty string produces no output (triggers the
|
||||
early-return guard in ~render-text~).
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test text-empty-string
|
||||
"Empty text produces no output"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
@@ -260,7 +260,7 @@ early-return guard in ~render-text~).
|
||||
Verify that ~:wrap-mode :none~ truncates the content string to fit
|
||||
within the available width, producing only the first N characters.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test text-truncates-when-no-wrap
|
||||
"Text with wrap-mode :none truncates at width"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
@@ -277,7 +277,7 @@ within the available width, producing only the first N characters.
|
||||
Verify that ~:wrap-mode :word~ breaks lines at word boundaries,
|
||||
distributing words across successive rows.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test text-word-wraps
|
||||
"Text with wrap-mode :word wraps at word boundaries"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
@@ -295,7 +295,7 @@ distributing words across successive rows.
|
||||
Verify that a single word longer than the available width is
|
||||
hard-broken at character boundaries into ~max-width~-sized chunks.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test text-word-wrap-single-word
|
||||
"A word longer than width is hard-broken at max-width"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
@@ -312,7 +312,7 @@ hard-broken at character boundaries into ~max-width~-sized chunks.
|
||||
Verify that ~span~ stores its text content and style attributes
|
||||
correctly, with unset attributes defaulting to ~nil~.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test span-creates-with-attributes
|
||||
"A span has text and optional style attributes"
|
||||
(let ((s (span "bold text" :bold t)))
|
||||
@@ -326,7 +326,7 @@ correctly, with unset attributes defaulting to ~nil~.
|
||||
Verify that ~make-text~ with ~:spans~ stores the provided span
|
||||
objects and they are accessible via ~text-spans~.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box-tests.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box-tests.lisp
|
||||
(test make-text-with-spans
|
||||
"Text with spans stores span objects"
|
||||
(let* ((sp (list (span "Hello" :bold t)
|
||||
@@ -346,7 +346,7 @@ color change) trigger incremental re-render. The ~layout-node~ slot
|
||||
holds the computed position and size from the layout engine. Border
|
||||
style, title, alignment, and colors are all configurable slots.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box.lisp
|
||||
(in-package :cl-tty.box)
|
||||
|
||||
(defclass box (dirty-mixin)
|
||||
@@ -367,7 +367,7 @@ The constructor wraps ~make-instance~ and passes layout parameters
|
||||
through to the layout node. Width and height are optional; when
|
||||
omitted the layout engine will compute them from parent constraints.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box.lisp
|
||||
(defun make-box (&key (border-style :single) title
|
||||
(title-align :left) fg bg
|
||||
width height)
|
||||
@@ -393,7 +393,7 @@ Title rendering supports ~:left~, ~:center~, and ~:right~ alignment
|
||||
with automatic truncation when the title is wider than available
|
||||
content area (width-4 when border is present).
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/box.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/box.lisp
|
||||
(defun render-box (box backend)
|
||||
"Render BOX at its computed layout position using BACKEND."
|
||||
(let ((ln (box-layout-node box))
|
||||
@@ -430,7 +430,7 @@ Multiple spans let a single Text contain bold, colored, or italicized
|
||||
runs. Each style attribute is a separate slot so consumers can
|
||||
inspect and apply them individually.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/text.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/text.lisp
|
||||
(in-package :cl-tty.box)
|
||||
|
||||
(defclass span ()
|
||||
@@ -450,7 +450,7 @@ inspect and apply them individually.
|
||||
keyword arguments for all style attributes. A ~nil~ default means
|
||||
"inherit/no-change" when merged with parent styling context.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/text.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/text.lisp
|
||||
(defun span (text &key bold italic underline reverse dim fg bg)
|
||||
(make-instance 'span
|
||||
:text text :bold bold :italic italic
|
||||
@@ -465,7 +465,7 @@ Spans are stored for future per-run styling but the current
|
||||
implementation renders all content as plain text. It inherits from
|
||||
~dirty-mixin~ so content, color, or size changes trigger re-render.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/text.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/text.lisp
|
||||
(defclass text (dirty-mixin)
|
||||
((layout-node :initform (make-layout-node) :accessor text-layout-node
|
||||
:initarg :layout-node)
|
||||
@@ -483,7 +483,7 @@ dimensions and content parameters. It defaults ~wrap-mode~ to ~:word~
|
||||
so text wraps by default, and creates a ~:column~-oriented layout
|
||||
node.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/text.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/text.lisp
|
||||
(defun make-text (content &key fg bg wrap-mode width height spans)
|
||||
(make-instance 'text
|
||||
:content content
|
||||
@@ -502,7 +502,7 @@ at successive row positions. For ~:none~, it truncates the content to
|
||||
fit the width in a single line. Empty content or zero dimensions
|
||||
triggers an early return.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/text.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/text.lisp
|
||||
(defun render-text (text-object backend)
|
||||
"Render TEXT-OBJECT at its computed layout position using BACKEND."
|
||||
(let ((ln (text-layout-node text-object))
|
||||
@@ -535,7 +535,7 @@ input into words, then packs them into lines respecting ~max-width~.
|
||||
Words that exceed ~max-width~ are hard-broken at character boundaries
|
||||
in chunks of ~max-width~ to ensure no line exceeds the limit.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/text.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/text.lisp
|
||||
(defun word-wrap (text max-width)
|
||||
"Split TEXT into lines, each <= MAX-WIDTH chars."
|
||||
(if (or (zerop max-width) (zerop (length text)))
|
||||
@@ -572,7 +572,7 @@ newline). It uses ~position-if~ to find delimiters and builds the
|
||||
word list iteratively. Consecutive delimiters are collapsed
|
||||
(only one advance per delimiter character).
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/components/text.lisp
|
||||
#+BEGIN_SRC lisp :tangle ~/.local/share/cl-tty/src/components/text.lisp
|
||||
(defun split-string (string)
|
||||
"Split STRING into words separated by whitespace."
|
||||
(loop with words = nil
|
||||
|
||||
Reference in New Issue
Block a user