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)))))))
(make-filter-help-text (scanner)
(lambda (a)
(let ((text (help-fields-get-text a))
(fn (help-fields-get-function a)))
(or (null fn)
(scan scanner
(if (stringp a)
a
(tui:tui-string->chars-string a))))))
(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))
(global-help (sort-help (key-paths *global-keymap*)))
(header-focused (colorize-header (_ "Focused window keys")))
@ -533,18 +538,18 @@ and `make-blocking-list-dialog-window') showing the full docstring for a command
global-help))
(handler-case
(let* ((scanner (create-scanner regex :case-insensitive-mode t))
(all-lines (remove-if-not (make-filter-help-text scanner)
(mapcar #'help-fields-get-text
fields)))
(actual-fields (remove-if-not (make-filter-help-text scanner)
fields))
(actual-lines (mapcar #'help-fields-get-text actual-fields))
(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*
fields
all-lines
actual-fields
actual-lines
#'help-expand
(_ "Quick help"))
(line-oriented-window:make-blocking-list-dialog-window specials:*main-window*
'("dummy")
'((:text "dummy"))
no-help-message
(lambda (a b)
(declare (ignore a b))))))

View File

@ -461,7 +461,9 @@ will fire the `callback' function (with the selected field from `all-fields'
(+ (find-max-line-width text-lines)
2)))
(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))
(* 0.5 window-width))))
(window-y (truncate (- (* 0.5 (win-height screen))

View File

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

View File

@ -98,7 +98,14 @@
`(with-accessors ((,slot croatoan-window)) ,window
,@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)
`(when ,window
(let ((,height (if (window-uses-border-p ,window)
@ -108,8 +115,8 @@
(win-width-no-border ,window)
(win-width ,window))))
(when (and (win-shown-p ,window)
(> ,height ,min-valid-height)
(> ,width ,min-valid-width))
(>= ,height ,min-valid-height)
(>= ,width ,min-valid-width))
,@body)))))
(defun win-clear (window &key (redraw t))