Commit 78176cef authored by David O'Toole's avatar David O'Toole

fix prompt click not sending cursor on correct text position

parent b7031e4c
......@@ -2275,6 +2275,24 @@ See sidebar for more commands to try.
(defmethod draw :after ((self buffer))
(when *notification*
(draw *notification*)))
(defmethod tap ((self prompt) mouse-x mouse-y)
(declare (ignore mouse-y))
(with-slots (x y width height clock point parent background
line) self
;; find the left edge of the data area
(let* ((left (+ x (label-width self) (dash 4)))
(tx (- mouse-x left)))
;; which character was clicked?
(let ((click-index
(block measuring
(dotimes (ix (length line))
(when (< tx (font-text-width
(subseq line 0 ix)
*font*))
(return-from measuring ix))))))
(when (numberp click-index)
(setf point click-index))))))
;; Data entry prompt:1 ends here
;; System terminal
......@@ -2323,7 +2341,6 @@ See sidebar for more commands to try.
(defparameter *terminal-background-color* "gray30")
(defparameter *terminal-bottom* (- *screen-height* (units 2)))
(defun draw-terminal (&optional (number-of-lines *terminal-display-lines*) translucent)
(let* ((x *terminal-left*)
(y *terminal-bottom*)
......
......@@ -2288,6 +2288,24 @@ above.
(defmethod draw :after ((self buffer))
(when *notification*
(draw *notification*)))
(defmethod tap ((self prompt) mouse-x mouse-y)
(declare (ignore mouse-y))
(with-slots (x y width height clock point parent background
line) self
;; find the left edge of the data area
(let* ((left (+ x (label-width self) (dash 3)))
(tx (- mouse-x left)))
;; which character was clicked?
(let ((click-index
(block measuring
(dotimes (ix (length line))
(when (< tx (font-text-width
(subseq line 0 ix)
*font*))
(return-from measuring ix))))))
(when (numberp click-index)
(setf point click-index))))))
#+end_src
* System terminal
......@@ -2335,7 +2353,6 @@ above.
(defparameter *terminal-background-color* "gray30")
(defparameter *terminal-bottom* (- *screen-height* (units 2)))
(defun draw-terminal (&optional (number-of-lines *terminal-display-lines*) translucent)
(let* ((x *terminal-left*)
(y *terminal-bottom*)
......
* Task list
** TODO fix dialog boxes
*** DONE [#A] fix exploding dialog
CLOSED: [2017-04-20 Thu 05:42]
*** TODO [#A] show error bubble and restore value when input incorrect
*** TODO [#A] fix halos not being in front
*** TODO [#B] don't allow halo on properties dialog
*** TODO [#B] fix click in text doesn't go to correct column
*** TODO [#B] ENTER should update value in property field
*** TODO [#C] fix BACKTAB not working (is BACKTAB being called?
*** TODO [#C] fix menubar not drawing over dialogs
*** TODO [#C] fix clicking away from menubar doesn't close menus or allow focusing
*** TODO [#C] add nice Apply/Cancel buttons
......@@ -688,3 +685,23 @@
:ARCHIVE_CATEGORY: tasks
:ARCHIVE_TODO: DONE
:END:
** DONE [#C] fix BACKTAB not working (is BACKTAB being called?
CLOSED: [2017-04-20 Thu 06:01]
:PROPERTIES:
:ARCHIVE_TIME: 2017-04-20 Thu 06:01
:ARCHIVE_FILE: ~/xelf/tasks.org
:ARCHIVE_OLPATH: Task list/fix dialog boxes
:ARCHIVE_CATEGORY: tasks
:ARCHIVE_TODO: DONE
:END:
** DONE [#A] fix exploding dialog
CLOSED: [2017-04-20 Thu 05:42]
:PROPERTIES:
:ARCHIVE_TIME: 2017-04-20 Thu 06:01
:ARCHIVE_FILE: ~/xelf/tasks.org
:ARCHIVE_OLPATH: Task list/fix dialog boxes
:ARCHIVE_CATEGORY: tasks
:ARCHIVE_TODO: DONE
:END:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment