mirror of
https://codeberg.org/cage/tinmop/
synced 2025-02-17 08:10:36 +01:00
- changed the way the input is completed, complete with current selected item in suggestion window.
This commit is contained in:
parent
e28ae6ff1a
commit
3ba5b83015
@ -434,8 +434,7 @@ be either `:keybinding' or `:string'. the former for key command the latter for
|
|||||||
(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))))
|
||||||
(setf command-line suggestion)
|
(setf command-line suggestion)
|
||||||
(move-point-to-end win command-line)
|
(move-point-to-end win command-line))))))
|
||||||
(win-hide suggestions-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
|
||||||
@ -478,12 +477,6 @@ command line."
|
|||||||
(move-suggestion-page-left command-window))
|
(move-suggestion-page-left command-window))
|
||||||
((eq :alt-right event)
|
((eq :alt-right event)
|
||||||
(move-suggestion-page-right command-window))
|
(move-suggestion-page-right command-window))
|
||||||
((eq :alt-up event)
|
|
||||||
(select-suggestion-next command-window))
|
|
||||||
((eq :alt-down event)
|
|
||||||
(select-suggestion-previous command-window))
|
|
||||||
((eq :alt-i event)
|
|
||||||
(insert-selected-suggestion command-window))
|
|
||||||
((eq :backspace event)
|
((eq :backspace event)
|
||||||
(setf command-line (delete-at-point command-window command-line :direction :left))
|
(setf command-line (delete-at-point command-window command-line :direction :left))
|
||||||
(show-candidate-completion command-window))
|
(show-candidate-completion command-window))
|
||||||
@ -499,13 +492,17 @@ command line."
|
|||||||
((eq :home event)
|
((eq :home event)
|
||||||
(move-point-to-start command-window))
|
(move-point-to-start command-window))
|
||||||
((eq :up event)
|
((eq :up event)
|
||||||
(multiple-value-bind (new-id new-input)
|
(if (win-shown-p suggestions-win)
|
||||||
(db:previous-in-history history-position prompt)
|
(select-suggestion-next command-window)
|
||||||
(set-history new-id new-input)))
|
(multiple-value-bind (new-id new-input)
|
||||||
|
(db:previous-in-history history-position prompt)
|
||||||
|
(set-history new-id new-input))))
|
||||||
((eq :down event)
|
((eq :down event)
|
||||||
(multiple-value-bind (new-id new-input)
|
(if (win-shown-p suggestions-win)
|
||||||
(db:next-in-history history-position prompt)
|
(select-suggestion-previous command-window)
|
||||||
(set-history new-id new-input)))
|
(multiple-value-bind (new-id new-input)
|
||||||
|
(db:next-in-history history-position prompt)
|
||||||
|
(set-history new-id new-input))))
|
||||||
((characterp event)
|
((characterp event)
|
||||||
(cond
|
(cond
|
||||||
((char= #\Newline event)
|
((char= #\Newline event)
|
||||||
@ -515,7 +512,7 @@ command line."
|
|||||||
(move-point-to-start command-window)
|
(move-point-to-start command-window)
|
||||||
(set-keybinding-mode command-window))
|
(set-keybinding-mode command-window))
|
||||||
((char= #\Tab event)
|
((char= #\Tab event)
|
||||||
(complete-at-point command-window))
|
(insert-selected-suggestion command-window))
|
||||||
(t
|
(t
|
||||||
(when (null suggestions-win)
|
(when (null suggestions-win)
|
||||||
(setf suggestions-win (complete-window:init)))
|
(setf suggestions-win (complete-window:init)))
|
||||||
|
@ -199,13 +199,13 @@ list af all possible candidtae for completion."
|
|||||||
(let ((strings '())
|
(let ((strings '())
|
||||||
(indices '())
|
(indices '())
|
||||||
(ordering ()))
|
(ordering ()))
|
||||||
(loop for candidate in bag when (< (length template)
|
(loop for candidate in bag when (<= (length template)
|
||||||
(length candidate))
|
(length candidate))
|
||||||
do
|
do
|
||||||
(when-let ((indices-matched (cl-i18n-utils:fuzzy-match template candidate
|
(when-let ((indices-matched (cl-i18n-utils:fuzzy-match template candidate
|
||||||
:similarity-match 5
|
:similarity-match 5
|
||||||
:similarity-mismatch -5
|
:similarity-mismatch -5
|
||||||
:penalty-weight 1 )))
|
:penalty-weight 1)))
|
||||||
(push candidate strings)
|
(push candidate strings)
|
||||||
(push indices-matched indices)))
|
(push indices-matched indices)))
|
||||||
(setf ordering (loop for i from 0 below (length strings) collect i))
|
(setf ordering (loop for i from 0 below (length strings) collect i))
|
||||||
|
@ -128,7 +128,9 @@
|
|||||||
(advance-res)
|
(advance-res)
|
||||||
(%advance))))
|
(%advance))))
|
||||||
(%advance)
|
(%advance)
|
||||||
res))))
|
(if (= prefix-count 0)
|
||||||
|
nil
|
||||||
|
res)))))
|
||||||
|
|
||||||
(defgeneric join-with-strings (object junction))
|
(defgeneric join-with-strings (object junction))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user