1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2025-02-17 08:10:36 +01:00

- made less confusing complete command line.

This commit is contained in:
cage 2021-07-31 17:24:28 +02:00
parent d2b2605a89
commit d97bad8d3b

View File

@ -336,12 +336,16 @@ be either `:keybinding' or `:string'. the former for key command the latter for
command-line) command-line)
(if candidates (if candidates
(if (null common-prefix) (if (null common-prefix)
(insert-selected-suggestion object) (progn
(insert-selected-suggestion object)
(suggestions-window:update-suggestions suggestions-win
command-line)
(reset-selected-suggestion-index object)
(setf (suggestions-window:current-page suggestions-win) 0))
(progn (progn
(when (length= candidates 1) (when (length= candidates 1)
(win-hide suggestions-win)) (win-hide suggestions-win))
(setf command-line common-prefix) (insert-selected-suggestion object)))
(move-point-to-end object command-line)))
(win-hide suggestions-win)))) (win-hide suggestions-win))))
object) object)
@ -421,25 +425,32 @@ be either `:keybinding' or `:string'. the former for key command the latter for
(defun select-suggestion-previous (win) (defun select-suggestion-previous (win)
(select-suggestion win -1)) (select-suggestion win -1))
(defun insert-selected-suggestion (win) (defun suggested-selection (win)
(with-accessors ((suggestions-win suggestions-win) (with-accessors ((suggestions-win suggestions-win)) win
(command-line command-line)) win
(when suggestions-win (when suggestions-win
(with-accessors ((current-page suggestions-window:current-page) (with-accessors ((current-page suggestions-window:current-page)
(paginated-info suggestions-window:paginated-info) (paginated-info suggestions-window:paginated-info)
(selected-item-row-index complete-window::selected-item-row-index) (selected-item-row-index complete-window::selected-item-row-index)
(selected-item-column-index complete-window::selected-item-column-index)) (selected-item-column-index complete-window::selected-item-column-index))
suggestions-win suggestions-win
(let* ((columns (elt paginated-info current-page)) (when-let* ((columns (elt paginated-info current-page))
(column (elt columns selected-item-column-index)) (column (elt columns selected-item-column-index))
(suggestion (trim-blanks (elt column selected-item-row-index)))) (suggestion (trim-blanks (elt column selected-item-row-index))))
(if (string= command-line suggestion) suggestion)))))
(progn
(select-suggestion-next win) (defun reset-selected-suggestion-index (win)
(insert-selected-suggestion win)) (with-accessors ((suggestions-win suggestions-win)) win
(progn (complete-window:reset-selected-item suggestions-win))
(setf command-line suggestion) win)
(move-point-to-end win command-line))))))))
(defun insert-selected-suggestion (win)
(with-accessors ((suggestions-win suggestions-win)
(command-line command-line)) win
(when suggestions-win
(let ((suggestion (suggested-selection win)))
(setf command-line suggestion)
(move-point-to-end win command-line))))
win)
(defun fire-user-input-event (win) (defun fire-user-input-event (win)
"Generates an event to notify that the user inserted an input on the "Generates an event to notify that the user inserted an input on the