1
0
Fork 0

- resetted selected item position when a 'suggestion-window' is shown.

This commit is contained in:
cage 2021-07-23 19:14:23 +02:00
parent 3ba5b83015
commit 6e92455667
3 changed files with 11 additions and 4 deletions

View File

@ -244,7 +244,7 @@ be either `:keybinding' or `:string'. the former for key command the latter for
(defgeneric remove-messages (object)) (defgeneric remove-messages (object))
(defun manage-command-event (command-window event) (defun manage-command-event (command-window event)
"Intercept UI events in keybindg mode" "Intercept UI events in keybindig mode"
(with-accessors ((command-line command-line) (with-accessors ((command-line command-line)
(suggestions-win suggestions-win)) command-window (suggestions-win suggestions-win)) command-window
;; some envents should by intercepted by command window ;; some envents should by intercepted by command window
@ -283,7 +283,7 @@ be either `:keybinding' or `:string'. the former for key command the latter for
:tree *global-keymap*)))))) :tree *global-keymap*))))))
(defmethod enqueue-command ((object command-window) command decode-key-p) (defmethod enqueue-command ((object command-window) command decode-key-p)
"Enqueue and process, if possibl,e `command` object, if decode-key "Enqueue and process, if possible `command` object, if decode-key
is not null decode key to something more human readable." is not null decode key to something more human readable."
(with-accessors ((command-line command-line) (with-accessors ((command-line command-line)
(info-message info-message) (info-message info-message)
@ -514,8 +514,9 @@ command line."
((char= #\Tab event) ((char= #\Tab event)
(insert-selected-suggestion command-window)) (insert-selected-suggestion command-window))
(t (t
(when (null suggestions-win) (if (null suggestions-win)
(setf suggestions-win (complete-window:init))) (setf suggestions-win (complete-window:init))
(complete-window:reset-selected-item suggestions-win))
(win-show suggestions-win) (win-show suggestions-win)
(setf command-line (setf command-line
(insert-at-point command-window event command-line)) (insert-at-point command-window event command-line))

View File

@ -40,6 +40,11 @@
(:documentation "A window to shows the possible completion for an (:documentation "A window to shows the possible completion for an
user input")) user input"))
(defun reset-selected-item (complete-win)
(setf (selected-item-column-index complete-win) +starting-item-index+
(selected-item-row-index complete-win) +starting-item-index+)
complete-win)
(defmethod calculate ((object complete-window) dt) (defmethod calculate ((object complete-window) dt)
(declare (ignore object dt))) (declare (ignore object dt)))

View File

@ -1743,6 +1743,7 @@
:complete-window :complete-window
:selected-item-row-index :selected-item-row-index
:selected-item-column-index :selected-item-column-index
:reset-selected-item
:init)) :init))
(defpackage :keybindings-window (defpackage :keybindings-window