abo-abo / ace-window

Quickly switch windows in Emacs
970 stars 86 forks source link

Question: How to see/scroll throgh aw-dispatch-alist? #172

Open ardpp opened 5 years ago

ardpp commented 5 years ago

When I call ace-window followed by ?, then aw-dispatch-alist is shown in the minibuffer which is too long in my case and is cut above. During an ivy completion of, for instance, counsel-find-file I can always press C-o to call hydra-ivy/body and grow/shrink the minibuffer.

Is there a possibility to have something similar for aw-dispatch-alist? At the moment any key not contained in this list or in aw-keys gives an error like "No such candidate ..."

abo-abo commented 5 years ago

Yes, I've noticed that sometimes using message will truncate the displayed lines. I'm not aware of a generic solution to this. Any info welcome.

Would be nice to implement something like ivy-dispatching-done-hydra for ace-window. PRs welcome.

obar commented 4 years ago

I've got a hack to put this message into two columns, as the topic came up on reddit and I'd noticed it myself. It's naive in that it doesn't check the available display space, but the same is true for the current approach. If you'd like I could put this in a PR?

(defun aw-show-dispatch-help ()
  "Display action shortucts in echo area."
  (interactive)
  (let* ((action-strings
          (cl-map 'list
                  (lambda (action)
                    (cl-destructuring-bind (key fn &optional description) action
                      (format "%s: %s"
                              (propertize
                               (char-to-string key)
                               'face 'aw-key-face)
                              (or description fn))))
                  aw-dispatch-alist))
         ;; Ensure first col is longer for odd #, pad second col with blank element
         ;; so cl-map combining lines doesn't stop early
         (rows (ceiling (/ (length action-strings) 2.0)))
         (as1 (cl-subseq action-strings 0 rows))
         (as2 (append (cl-subseq action-strings rows) '(nil)))
         (max-first-col-width (apply 'max (cl-map 'list 'string-width as1))))
    (message (mapconcat 'identity
                        (cl-map 'list
                                (lambda (a1 a2)
                                  (concat
                                   (truncate-string-to-width a1 max-first-col-width nil ?\s)
                                   "  " a2))
                                as1 as2)
                        "\n")))
  ;; Prevent this from replacing any help display
  ;; in the minibuffer.
  (let (aw-minibuffer-flag)
    (mapc #'delete-overlay aw-overlays-back)
    (call-interactively 'ace-window)))
henrythebuilder commented 2 months ago

Hi, my workaround for this problem was to increase the value of max-mini-window-height, in my case it was enough: (setq max-mini-window-height 0.35)