fix: cursor movement marks dirty in text-input and textarea (regression from cursor rendering fix)
This commit is contained in:
@@ -72,17 +72,21 @@
|
||||
;;; ---------------------------------------------------------------------------
|
||||
(defun text-input-move-left (input)
|
||||
(when (plusp (text-input-cursor input))
|
||||
(decf (text-input-cursor input))))
|
||||
(decf (text-input-cursor input)))
|
||||
(mark-dirty input))
|
||||
|
||||
(defun text-input-move-right (input)
|
||||
(when (< (text-input-cursor input) (length (text-input-value input)))
|
||||
(incf (text-input-cursor input))))
|
||||
(incf (text-input-cursor input)))
|
||||
(mark-dirty input))
|
||||
|
||||
(defun text-input-move-home (input)
|
||||
(setf (text-input-cursor input) 0))
|
||||
(setf (text-input-cursor input) 0)
|
||||
(mark-dirty input))
|
||||
|
||||
(defun text-input-move-end (input)
|
||||
(setf (text-input-cursor input) (length (text-input-value input))))
|
||||
(setf (text-input-cursor input) (length (text-input-value input)))
|
||||
(mark-dirty input))
|
||||
|
||||
(defun text-input-delete-word-before (input)
|
||||
"Delete from cursor back to previous word boundary."
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
(max 0 (min (textarea-cursor-row ta) (1- (length lines)))))
|
||||
(let ((line-len (length (nth (textarea-cursor-row ta) lines))))
|
||||
(setf (textarea-cursor-col ta)
|
||||
(max 0 (min (textarea-cursor-col ta) line-len))))))
|
||||
(max 0 (min (textarea-cursor-col ta) line-len)))))
|
||||
(mark-dirty ta))
|
||||
|
||||
;;; ---------------------------------------------------------------------------
|
||||
;;; Utility: join strings with newline
|
||||
@@ -207,11 +208,13 @@
|
||||
(textarea-ensure-cursor ta))
|
||||
(:up (textarea-move-up ta))
|
||||
(:down (textarea-move-down ta))
|
||||
(:home (setf (textarea-cursor-col ta) 0))
|
||||
(:home (setf (textarea-cursor-col ta) 0)
|
||||
(textarea-ensure-cursor ta))
|
||||
(:end (let ((lines (textarea-lines ta)))
|
||||
(when (< (textarea-cursor-row ta) (length lines))
|
||||
(setf (textarea-cursor-col ta)
|
||||
(length (nth (textarea-cursor-row ta) lines))))))
|
||||
(length (nth (textarea-cursor-row ta) lines))))
|
||||
(textarea-ensure-cursor ta)))
|
||||
(:enter (let ((cb (textarea-on-submit ta)))
|
||||
(if cb
|
||||
(funcall cb (textarea-value ta))
|
||||
|
||||
Reference in New Issue
Block a user