v0.12.0: Terminal capability detection, GPL 3.0 license, roadmap rewrite
LICENSE: - Added GNU General Public License v3.0 - Updated README.org to reflect GPL 3.0 ROADMAP: - Complete rewrite to reflect actual project state - Removed croatoan/ncurses/Yoga FFI references - Marked all 11 existing versions DONE - Added v0.12.0-0.14.0 for new features (detection, pipeline, mouse) DETECTION (v0.12.0): - detect-backend: auto-detect modern vs simple backend - detect-backend-by-env: check COLORTERM env var - detect-backend-by-tty: check interactive-stream-p - detect-backend-by-da1: query terminal via ESC[c (best-effort) - *detected-backend* cache for zero-cost subsequent calls - Added detection.lisp to ASDF and package exports - Added 2 new tests (360 total, all passing) - demo.lisp updated to use detect-backend ORG BACKPORT (pre-existing fixes synced): - dialog.org: render-dialog/render-toast fixes, class initforms - scrollbox-tabbar.org: background-element -> bright-black, remove duplicate render - select.org: remove duplicate render export - text-input.org: remove duplicate %split-string, undo overflow fix - layout-engine.org: quoted-literal -> list constructors, normalize-box rewrite - mouse.org: add missing exports, fix test
This commit is contained in:
@@ -94,16 +94,14 @@ Render a dialog: backdrop (dimmed full-screen), then centered panel.
|
||||
(when (dialog-content dialog)
|
||||
(render-component (dialog-content dialog) screen (1+ x) (1+ y) (- dw 2) (- dh 2))))))
|
||||
#+END_SRC
|
||||
*** push-dialog / pop-dialog
|
||||
|
||||
--- per-function: push-dialog
|
||||
|
||||
Push a dialog onto the stack and give it focus.
|
||||
~push-dialog~ pushes a dialog onto =*dialog-stack*=. ~pop-dialog~ pops the
|
||||
top dialog and calls its ~:on-dismiss~ callback if set.
|
||||
|
||||
#+BEGIN_SRC lisp :tangle no
|
||||
(defun push-dialog (dialog)
|
||||
(push dialog *dialog-stack*)
|
||||
(when (typep (dialog-content dialog) 'focusable-mixin)
|
||||
(focus (dialog-content dialog)))
|
||||
dialog)
|
||||
#+END_SRC
|
||||
|
||||
@@ -290,7 +288,7 @@ Remove a toast from the list.
|
||||
;;; dialog-package.lisp — Package definition for cl-tty.dialog
|
||||
|
||||
(defpackage :cl-tty.dialog
|
||||
(:use :cl :cl-tty :cl-tty.select :cl-tty.input)
|
||||
(:use :cl :cl-tty.input :cl-tty.select)
|
||||
(:export
|
||||
#:dialog
|
||||
#:dialog-title
|
||||
@@ -339,7 +337,7 @@ Remove a toast from the list.
|
||||
(defclass dialog ()
|
||||
((title :initarg :title :accessor dialog-title)
|
||||
(size :initarg :size :initform :medium :accessor dialog-size)
|
||||
(content :initarg :content :accessor dialog-content)
|
||||
(content :initarg :content :initform nil :accessor dialog-content)
|
||||
(on-dismiss :initarg :on-dismiss :initform nil :accessor dialog-on-dismiss)))
|
||||
|
||||
(defun dialog-size-pixels (size)
|
||||
@@ -353,17 +351,19 @@ Remove a toast from the list.
|
||||
(multiple-value-bind (dw dh) (dialog-size-pixels (dialog-size dialog))
|
||||
(let ((x (floor (- w dw) 2))
|
||||
(y (floor (- h dh) 2)))
|
||||
;; Backdrop — dim the full screen
|
||||
(dotimes (row h)
|
||||
(dotimes (col w)
|
||||
(backend-write screen col row " " :bg :dim)))
|
||||
(draw-rect screen 0 row w 1 :bg :bright-black))
|
||||
;; Dialog panel
|
||||
(draw-border screen x y dw dh :single :title (dialog-title dialog))
|
||||
(when (dialog-content dialog)
|
||||
(render-component (dialog-content dialog) screen (1+ x) (1+ y) (- dw 2) (- dh 2))))))
|
||||
;; Content rendering delegated to component system
|
||||
(draw-text screen (1+ x) (1+ y)
|
||||
(format nil "~a" (dialog-content dialog))
|
||||
:white :default)))))
|
||||
|
||||
(defun push-dialog (dialog)
|
||||
(push dialog *dialog-stack*)
|
||||
(when (typep (dialog-content dialog) 'focusable-mixin)
|
||||
(focus (dialog-content dialog)))
|
||||
dialog)
|
||||
|
||||
(defun pop-dialog ()
|
||||
@@ -434,7 +434,7 @@ Remove a toast from the list.
|
||||
(concatenate 'string (subseq msg 0 (- max-w 5)) "...")
|
||||
msg)))
|
||||
(draw-rect screen x 0 max-w 1 :bg color)
|
||||
(backend-write screen (1+ x) 0 text :fg :white :bold t)))
|
||||
(draw-text screen (1+ x) 0 text :white color :bold t)))
|
||||
|
||||
(defun toast (message &key (variant :info) (duration 5000))
|
||||
(let ((toast (make-instance 'toast :message message :variant variant)))
|
||||
@@ -457,8 +457,8 @@ Remove a toast from the list.
|
||||
|
||||
(in-package :cl-tty-dialog-test)
|
||||
|
||||
(def-suite :dialog-suite :description "Dialog + Toast tests for cl-tty.dialog")
|
||||
(in-suite :dialog-suite)
|
||||
(def-suite dialog-suite :description "Dialog + Toast tests for cl-tty.dialog")
|
||||
(in-suite dialog-suite)
|
||||
|
||||
(def-test dialog-create ()
|
||||
(let ((d (make-instance 'dialog :title "Test")))
|
||||
|
||||
Reference in New Issue
Block a user