review fixes: package exports, hit-test safety, draw-text signature
This commit is contained in:
@@ -309,14 +309,7 @@ Remove a toast from the list.
|
|||||||
#:toast-variant
|
#:toast-variant
|
||||||
#:render-toast
|
#:render-toast
|
||||||
#:dismiss-toast
|
#:dismiss-toast
|
||||||
#:*toasts*
|
#:*toasts*))
|
||||||
;; Tests
|
|
||||||
#:dialog-create
|
|
||||||
#:dialog-size-small
|
|
||||||
#:dialog-size-medium
|
|
||||||
#:dialog-push-pop
|
|
||||||
#:toast-create
|
|
||||||
#:toast-dismiss))
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_SRC lisp :tangle ../src/components/dialog.lisp :noweb no
|
#+BEGIN_SRC lisp :tangle ../src/components/dialog.lisp :noweb no
|
||||||
|
|||||||
@@ -201,14 +201,16 @@ See =docs/plans/2026-05-11-rendering-pipeline.md= for full implementation plan.
|
|||||||
:bold bold :italic italic :underline underline
|
:bold bold :italic italic :underline underline
|
||||||
:link-url link-url)))))
|
:link-url link-url)))))
|
||||||
|
|
||||||
(defmethod draw-text ((fb framebuffer-backend) x y string fg bg &rest attrs)
|
(defmethod draw-text ((fb framebuffer-backend) x y string fg bg
|
||||||
|
&key bold italic underline reverse dim blink
|
||||||
|
(link-url nil link-url-p)
|
||||||
|
&allow-other-keys)
|
||||||
|
(declare (ignore reverse dim blink link-url-p))
|
||||||
(loop for i from 0 below (length string)
|
(loop for i from 0 below (length string)
|
||||||
do (%set-cell fb (+ x i) y (char string i)
|
do (%set-cell fb (+ x i) y (char string i)
|
||||||
:fg fg :bg bg
|
:fg fg :bg bg
|
||||||
:bold (getf attrs :bold)
|
:bold bold :italic italic :underline underline
|
||||||
:italic (getf attrs :italic)
|
:link-url link-url)))
|
||||||
:underline (getf attrs :underline)
|
|
||||||
:link-url (getf attrs :link-url))))
|
|
||||||
|
|
||||||
(defmethod draw-rect ((fb framebuffer-backend) x y w h &key fg bg style)
|
(defmethod draw-rect ((fb framebuffer-backend) x y w h &key fg bg style)
|
||||||
(declare (ignore style))
|
(declare (ignore style))
|
||||||
|
|||||||
@@ -60,8 +60,10 @@ module adds:
|
|||||||
|
|
||||||
(defun hit-test (root x y)
|
(defun hit-test (root x y)
|
||||||
(labels ((recurse (node)
|
(labels ((recurse (node)
|
||||||
(when (and (slot-boundp node 'x) (slot-boundp node 'y)
|
(when (and (slot-exists-p node 'x) (slot-boundp node 'x)
|
||||||
(slot-boundp node 'width) (slot-boundp node 'height))
|
(slot-exists-p node 'y) (slot-boundp node 'y)
|
||||||
|
(slot-exists-p node 'width) (slot-boundp node 'width)
|
||||||
|
(slot-exists-p node 'height) (slot-boundp node 'height))
|
||||||
(let ((nx (slot-value node 'x))
|
(let ((nx (slot-value node 'x))
|
||||||
(ny (slot-value node 'y))
|
(ny (slot-value node 'y))
|
||||||
(nw (slot-value node 'width))
|
(nw (slot-value node 'width))
|
||||||
@@ -152,8 +154,10 @@ module adds:
|
|||||||
(is-true (typep m 'mouse-mixin))))
|
(is-true (typep m 'mouse-mixin))))
|
||||||
|
|
||||||
(def-test mouse-hit-test-point ()
|
(def-test mouse-hit-test-point ()
|
||||||
|
"hit-test returns nil when no component has position slots bound"
|
||||||
(let ((obj (make-instance 'mouse-mixin)))
|
(let ((obj (make-instance 'mouse-mixin)))
|
||||||
(is-true t))) ;; placeholder
|
(is-false (hit-test obj 0 0))
|
||||||
|
(is-false (hit-test obj 100 100))))
|
||||||
|
|
||||||
(def-test selection-set-and-get ()
|
(def-test selection-set-and-get ()
|
||||||
(setf cl-tty.mouse::*selection* (make-selection :text "hello"))
|
(setf cl-tty.mouse::*selection* (make-selection :text "hello"))
|
||||||
|
|||||||
@@ -22,11 +22,4 @@
|
|||||||
#:toast-variant
|
#:toast-variant
|
||||||
#:render-toast
|
#:render-toast
|
||||||
#:dismiss-toast
|
#:dismiss-toast
|
||||||
#:*toasts*
|
#:*toasts*))
|
||||||
;; Tests
|
|
||||||
#:dialog-create
|
|
||||||
#:dialog-size-small
|
|
||||||
#:dialog-size-medium
|
|
||||||
#:dialog-push-pop
|
|
||||||
#:toast-create
|
|
||||||
#:toast-dismiss))
|
|
||||||
|
|||||||
@@ -3,63 +3,9 @@
|
|||||||
(defpackage :cl-tty.markdown
|
(defpackage :cl-tty.markdown
|
||||||
(:use :cl)
|
(:use :cl)
|
||||||
(:export
|
(:export
|
||||||
;; Data structures
|
#:make-md-node #:md-node-p #:md-node-text
|
||||||
#:make-md-node
|
#:parse-blocks #:parse-inline
|
||||||
#:md-node-p
|
#:*syntax-highlighters* #:highlight-code
|
||||||
#:md-node-text
|
#:classify-diff-line #:render-md #:render-md-node
|
||||||
;; Parsing
|
#:render-markdown #:render-inline
|
||||||
#:parse-blocks
|
#:apply-style #:apply-styles))
|
||||||
#:parse-inline
|
|
||||||
;; Highlighting
|
|
||||||
#:*syntax-highlighters*
|
|
||||||
#:highlight-code
|
|
||||||
;; Diff
|
|
||||||
#:classify-diff-line
|
|
||||||
;; Rendering
|
|
||||||
#:render-md
|
|
||||||
#:render-md-node
|
|
||||||
#:render-markdown
|
|
||||||
#:render-inline
|
|
||||||
;; Styles
|
|
||||||
#:apply-style
|
|
||||||
#:apply-styles
|
|
||||||
;; Tests (exported test symbols for ASDF integration)
|
|
||||||
#:heading-parsing
|
|
||||||
#:heading-levels
|
|
||||||
#:heading-with-inline-formatting
|
|
||||||
#:paragraph-parsing
|
|
||||||
#:paragraph-multi-line
|
|
||||||
#:bold-parsing
|
|
||||||
#:italic-parsing
|
|
||||||
#:bold-italic-combined
|
|
||||||
#:inline-code-parsing
|
|
||||||
#:link-parsing
|
|
||||||
#:code-block-parsing
|
|
||||||
#:code-block-unknown-language
|
|
||||||
#:blockquote-parsing
|
|
||||||
#:list-item-parsing
|
|
||||||
#:ordered-list-parsing
|
|
||||||
#:thematic-break-parsing
|
|
||||||
#:highlight-lisp-keyword
|
|
||||||
#:highlight-lisp-builtin
|
|
||||||
#:highlight-unknown-language
|
|
||||||
#:highlight-comment
|
|
||||||
#:classify-diff-added
|
|
||||||
#:classify-diff-removed
|
|
||||||
#:classify-diff-hunk
|
|
||||||
#:classify-diff-context
|
|
||||||
#:render-heading-output
|
|
||||||
#:render-paragraph-output
|
|
||||||
#:render-thematic-break-output
|
|
||||||
#:render-code-block-output
|
|
||||||
#:render-diff-block-output
|
|
||||||
#:markdown-integration
|
|
||||||
#:render-markdown-string
|
|
||||||
;; Internal (for testability)
|
|
||||||
#:classify-line
|
|
||||||
#:split-string-into-lines
|
|
||||||
#:find-closing-marker
|
|
||||||
#:string-prefix-p
|
|
||||||
#:tokenize-line
|
|
||||||
#:apply-highlight-token
|
|
||||||
#:apply-highlight-style))
|
|
||||||
|
|||||||
@@ -17,8 +17,10 @@
|
|||||||
|
|
||||||
(defun hit-test (root x y)
|
(defun hit-test (root x y)
|
||||||
(labels ((recurse (node)
|
(labels ((recurse (node)
|
||||||
(when (and (slot-boundp node 'x) (slot-boundp node 'y)
|
(when (and (slot-exists-p node 'x) (slot-boundp node 'x)
|
||||||
(slot-boundp node 'width) (slot-boundp node 'height))
|
(slot-exists-p node 'y) (slot-boundp node 'y)
|
||||||
|
(slot-exists-p node 'width) (slot-boundp node 'width)
|
||||||
|
(slot-exists-p node 'height) (slot-boundp node 'height))
|
||||||
(let ((nx (slot-value node 'x))
|
(let ((nx (slot-value node 'x))
|
||||||
(ny (slot-value node 'y))
|
(ny (slot-value node 'y))
|
||||||
(nw (slot-value node 'width))
|
(nw (slot-value node 'width))
|
||||||
|
|||||||
@@ -75,14 +75,16 @@
|
|||||||
:bold bold :italic italic :underline underline
|
:bold bold :italic italic :underline underline
|
||||||
:link-url link-url)))))
|
:link-url link-url)))))
|
||||||
|
|
||||||
(defmethod draw-text ((fb framebuffer-backend) x y string fg bg &rest attrs)
|
(defmethod draw-text ((fb framebuffer-backend) x y string fg bg
|
||||||
|
&key bold italic underline reverse dim blink
|
||||||
|
(link-url nil link-url-p)
|
||||||
|
&allow-other-keys)
|
||||||
|
(declare (ignore reverse dim blink link-url-p))
|
||||||
(loop for i from 0 below (length string)
|
(loop for i from 0 below (length string)
|
||||||
do (%set-cell fb (+ x i) y (char string i)
|
do (%set-cell fb (+ x i) y (char string i)
|
||||||
:fg fg :bg bg
|
:fg fg :bg bg
|
||||||
:bold (getf attrs :bold)
|
:bold bold :italic italic :underline underline
|
||||||
:italic (getf attrs :italic)
|
:link-url link-url)))
|
||||||
:underline (getf attrs :underline)
|
|
||||||
:link-url (getf attrs :link-url))))
|
|
||||||
|
|
||||||
(defmethod draw-rect ((fb framebuffer-backend) x y w h &key fg bg style)
|
(defmethod draw-rect ((fb framebuffer-backend) x y w h &key fg bg style)
|
||||||
(declare (ignore style))
|
(declare (ignore style))
|
||||||
|
|||||||
@@ -9,8 +9,10 @@
|
|||||||
(is-true (typep m 'mouse-mixin))))
|
(is-true (typep m 'mouse-mixin))))
|
||||||
|
|
||||||
(def-test mouse-hit-test-point ()
|
(def-test mouse-hit-test-point ()
|
||||||
|
"hit-test returns nil when no component has position slots bound"
|
||||||
(let ((obj (make-instance 'mouse-mixin)))
|
(let ((obj (make-instance 'mouse-mixin)))
|
||||||
(is-true t))) ;; placeholder
|
(is-false (hit-test obj 0 0))
|
||||||
|
(is-false (hit-test obj 100 100))))
|
||||||
|
|
||||||
(def-test selection-set-and-get ()
|
(def-test selection-set-and-get ()
|
||||||
(setf cl-tty.mouse::*selection* (make-selection :text "hello"))
|
(setf cl-tty.mouse::*selection* (make-selection :text "hello"))
|
||||||
|
|||||||
Reference in New Issue
Block a user