diff options
| author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2026-05-01 14:16:07 -0300 |
|---|---|---|
| committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2026-05-01 14:16:07 -0300 |
| commit | a4411bcc3919c2099934fd49664ee689460ebf80 (patch) | |
| tree | 524492a5febcd921528da7634ff91068b8c63d02 /cursor.lisp | |
| parent | d1816df4c029447f94963355cbdce5c434063ee6 (diff) | |
| download | utils-a4411bcc3919c2099934fd49664ee689460ebf80.tar.gz utils-a4411bcc3919c2099934fd49664ee689460ebf80.zip | |
Diffstat (limited to 'cursor.lisp')
| -rw-r--r-- | cursor.lisp | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/cursor.lisp b/cursor.lisp deleted file mode 100644 index d3012ab..0000000 --- a/cursor.lisp +++ /dev/null @@ -1,31 +0,0 @@ -(in-package #:cursor) - -(defclass text () - ((data :type simple-string :initarg :data :reader data :initform "") - (index :type (unsigned-byte 44) :initarg :index :accessor index :initform 0))) - -(defun has-data? (cursor) - (< (index cursor) (length (data cursor)))) - -(defun peek (cursor) - (char (data cursor) - (index cursor))) - -(defun advance (cursor) - (make-instance 'text - :data (data cursor) - :index (+ (index cursor) 1))) - -(defun distance (from to) - (- (index to) - (index from))) - -(defmethod print-object ((obj text) stream) - (print-unreadable-object (obj stream :type t) - (let ((str (if (has-data? obj) - (format nil "~{~a[4;33m~a[m~a~}" - (str:context-window (data obj) - (index obj) - :side-length 10)) - "END OF DATA"))) - (substitute #\↲ #\Newline str)))) |
