v0.14.0: sync org files with mouse selection and framebuffer inspection
This commit is contained in:
@@ -306,6 +306,32 @@ Returns the number of changed cells."
|
||||
count))
|
||||
#+END_SRC
|
||||
|
||||
** Frame inspection (for mouse selection / link clicking)
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/rendering/framebuffer.lisp
|
||||
;;; --- Frame inspection ---------------------------------------------------
|
||||
|
||||
(defun fb-cell-link-url (fb x y)
|
||||
"Return the link URL at (X Y) in framebuffer FB, or nil."
|
||||
(when (and (arrayp fb) (>= y 0) (< y (array-dimension fb 0))
|
||||
(>= x 0) (< x (array-dimension fb 1)))
|
||||
(let ((c (aref fb y x)))
|
||||
(cell-link-url c))))
|
||||
|
||||
(defun extract-text (fb x1 y1 x2 y2)
|
||||
"Extract visible text from the rectangle between (X1,Y1) and (X2,Y2)."
|
||||
(let ((x-min (min x1 x2)) (x-max (max x1 x2))
|
||||
(y-min (min y1 y2)) (y-max (max y1 y2))
|
||||
(h (if (arrayp fb) (array-dimension fb 0) 0))
|
||||
(w (if (arrayp fb) (array-dimension fb 1) 0)))
|
||||
(with-output-to-string (s)
|
||||
(loop for y from y-min to (min y-max (1- h))
|
||||
do (loop for x from x-min to (min x-max (1- w))
|
||||
do (let ((c (aref fb y x)))
|
||||
(princ (cell-char c) s)))
|
||||
(when (< y y-max) (princ #\Newline s))))))
|
||||
#+END_SRC
|
||||
|
||||
** Scissor clipping
|
||||
|
||||
#+BEGIN_SRC lisp :tangle ../src/rendering/framebuffer.lisp
|
||||
|
||||
Reference in New Issue
Block a user