Skip to content
Browse files

Dump the cursored-strings experiment.

  • Loading branch information...
1 parent a285da7 commit 1263def2ea22d1665b38c154691d860c894534cb Jesse Alama committed
Showing with 0 additions and 57 deletions.
  1. +0 −57 ce-utils.el
View
57 ce-utils.el
@@ -17,63 +17,6 @@
list-of-arrays))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Strings with cursor
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defclass cursored-string ()
- ((string :initarg :string
- :initform ""
- :type string
- :documentation "The underlying string (sequence of characters).")
- (cursor :initarg :initial-position
- :initform 0
- :type integer
- :documentation "The current position of the cursored string.")))
-
-(defmethod cs-length ((cs cursored-string))
- (values (length (oref cs string))))
-
-(defconst +cs-render-separator+ "|"
- "The string used to separate the characters of a rendered cursorsed-string.")
-
-(defmethod cs-digitize ((cs cursored-string))
- (let ((string (copy-sequence (oref cs string)))
- (cursor-pos (oref cs cursor)))
- (with-output-to-string
- (loop
- initially (princ (format "%s" +cs-render-separator+))
- for char across string
- do
- (princ (format " %c %s" char +cs-render-separator+))))))
-
-(defmethod cursor-in-digitized-string ((cs cursored-string))
- "What is the cursor in CS, were it digitized?
-
-If cs-digitize changes, this function may need to be changed."
- (let ((cursor (oref cs cursor)))
- (if (zerop cursor)
- 2
- (+ (* cursor 4) 3))))
-
-(defmethod range-of-cursor-in-digitized-string ((cs cursored-string))
- "What would the range of the cursor of CS be if it were digitized?
-
-The answer is a pair of integers.
-
-If cs-digitize changes, then this function may need to be changed."
- (let ((cursor-in-digitized (cursor-in-digitized-string cs)))
- (cons (- cursor-in-digitized 2)
- (+ cursor-in-digitized 1))))
-
-(defmethod cs-render ((cs cursored-string))
- (let ((digitized (cs-digitize cs)))
- (let ((range (range-of-cursor-in-digitized-string cs)))
- (destructuring-bind (begin . end)
- range
- (add-text-properties begin end (list 'face 'highlight) digitized)))
- digitized))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Strings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

0 comments on commit 1263def

Please sign in to comment.
Something went wrong with that request. Please try again.