1
0
Fork 0

- fixed regression: command apropos works again.

This commit is contained in:
cage 2021-08-14 16:09:10 +02:00
parent 5217636b34
commit 0247325a5d
4 changed files with 40 additions and 24 deletions

View File

@ -514,10 +514,15 @@ and `make-blocking-list-dialog-window') showing the full docstring for a command
(string< text-a text-b))))))) (string< text-a text-b)))))))
(make-filter-help-text (scanner) (make-filter-help-text (scanner)
(lambda (a) (lambda (a)
(scan scanner (let ((text (help-fields-get-text a))
(if (stringp a) (fn (help-fields-get-function a)))
a (or (null fn)
(tui:tui-string->chars-string a)))))) (scan scanner
(if (stringp text)
text
(tui:tui-string->chars-string text)))))))
(valid-results-p (fields)
(> (length fields) 2)))
(when-let* ((focused-keybindings (main-window:focused-keybindings main-window)) (when-let* ((focused-keybindings (main-window:focused-keybindings main-window))
(global-help (sort-help (key-paths *global-keymap*))) (global-help (sort-help (key-paths *global-keymap*)))
(header-focused (colorize-header (_ "Focused window keys"))) (header-focused (colorize-header (_ "Focused window keys")))
@ -532,22 +537,22 @@ and `make-blocking-list-dialog-window') showing the full docstring for a command
(list global-header-fields) (list global-header-fields)
global-help)) global-help))
(handler-case (handler-case
(let* ((scanner (create-scanner regex :case-insensitive-mode t)) (let* ((scanner (create-scanner regex :case-insensitive-mode t))
(all-lines (remove-if-not (make-filter-help-text scanner) (actual-fields (remove-if-not (make-filter-help-text scanner)
(mapcar #'help-fields-get-text fields))
fields))) (actual-lines (mapcar #'help-fields-get-text actual-fields))
(no-help-message (list (_ "No command matching your criteria found")))) (no-help-message (list (_ "No command matching your criteria found"))))
(if all-lines (if (valid-results-p actual-fields)
(line-oriented-window:make-blocking-list-dialog-window specials:*main-window* (line-oriented-window:make-blocking-list-dialog-window specials:*main-window*
fields actual-fields
all-lines actual-lines
#'help-expand #'help-expand
(_ "Quick help")) (_ "Quick help"))
(line-oriented-window:make-blocking-list-dialog-window specials:*main-window* (line-oriented-window:make-blocking-list-dialog-window specials:*main-window*
'("dummy") '((:text "dummy"))
no-help-message no-help-message
(lambda (a b) (lambda (a b)
(declare (ignore a b)))))) (declare (ignore a b))))))
(cl-ppcre:ppcre-syntax-error (e) (cl-ppcre:ppcre-syntax-error (e)
(ui:error-message (format nil (ui:error-message (format nil
(_ "invalid regular expression ~s ~a") (_ "invalid regular expression ~s ~a")

View File

@ -461,7 +461,9 @@ will fire the `callback' function (with the selected field from `all-fields'
(+ (find-max-line-width text-lines) (+ (find-max-line-width text-lines)
2))) 2)))
(window-height (min (truncate (* 0.9 (win-height screen))) (window-height (min (truncate (* 0.9 (win-height screen)))
(+ (length text-lines) 2))) (max (length text-lines)
(+ +min-shown-win-height+
2))))
(window-x (truncate (- (* 0.5 (win-width screen)) (window-x (truncate (- (* 0.5 (win-width screen))
(* 0.5 window-width)))) (* 0.5 window-width))))
(window-y (truncate (- (* 0.5 (win-height screen)) (window-y (truncate (- (* 0.5 (win-height screen))

View File

@ -1630,6 +1630,8 @@
:wrapper-window :wrapper-window
:croatoan-window :croatoan-window
:with-croatoan-window :with-croatoan-window
:+min-shown-win-height+
:+min-shown-win-width+
:when-window-shown :when-window-shown
:keybindings :keybindings
:win-clear :win-clear

View File

@ -98,7 +98,14 @@
`(with-accessors ((,slot croatoan-window)) ,window `(with-accessors ((,slot croatoan-window)) ,window
,@body)) ,@body))
(defmacro when-window-shown ((window &key (min-valid-height 2) (min-valid-width 2)) &body body) (define-constant +min-shown-win-height+ 3 :test #'=)
(define-constant +min-shown-win-width+ 3 :test #'=)
(defmacro when-window-shown ((window &key
(min-valid-height +min-shown-win-height+)
(min-valid-width +min-shown-win-width+))
&body body)
(with-gensyms (height width) (with-gensyms (height width)
`(when ,window `(when ,window
(let ((,height (if (window-uses-border-p ,window) (let ((,height (if (window-uses-border-p ,window)
@ -108,8 +115,8 @@
(win-width-no-border ,window) (win-width-no-border ,window)
(win-width ,window)))) (win-width ,window))))
(when (and (win-shown-p ,window) (when (and (win-shown-p ,window)
(> ,height ,min-valid-height) (>= ,height ,min-valid-height)
(> ,width ,min-valid-width)) (>= ,width ,min-valid-width))
,@body))))) ,@body)))))
(defun win-clear (window &key (redraw t)) (defun win-clear (window &key (redraw t))