casouri / eldoc-box

childframe doc for eglot and anything that uses eldoc
342 stars 27 forks source link

When using eldoc-box-hover-at-point-mode can't scroll child frame #91

Closed leafarbelm closed 9 months ago

leafarbelm commented 10 months ago

Hi! When i'm using

(add-hook 'eglot-managed-mode-hook #'eldoc-box-hover-at-point-mode t)

And try to scroll a child frame with the command scroll-other-window-down the child frame disapear but if i disable the eldoc-box-hover-at-point-mode and try to scroll the child frame from eldoc-box-hover-mode or eldoc-box-help-at-point it works.

jeff-phil commented 10 months ago

Here's what I do:

  (defun my/eldoc-box-scroll-up ()
    "Scroll up in `eldoc-box--frame'"
    (interactive)
    (with-current-buffer eldoc-box--buffer
      (with-selected-frame eldoc-box--frame
        (scroll-down 3))))
  (defun my/eldoc-box-scroll-down ()
    "Scroll down in `eldoc-box--frame'"
    (interactive)
    (with-current-buffer eldoc-box--buffer
      (with-selected-frame eldoc-box--frame
        (scroll-up 3))))
  (keymap-set eglot-mode-map "C-s-n" #'my/eldoc-box-scroll-down)
  (keymap-set eglot-mode-map "C-s-p" #'my/eldoc-box-scroll-up)
  (keymap-set eglot-mode-map "C-s-<up>" #'my/eldoc-box-scroll-down)
  (keymap-set eglot-mode-map "C-s-<down>" #'my/eldoc-box-scroll-up)

@casouri - I'll submit a PR if you want to add scroll functions like these for folks to configure their scrolling.

casouri commented 10 months ago

Thanks, that looks cool. Still, I'll be happier if scroll-other-window-down works. @leafbel, could you try adding scroll-other-window-down to eldoc-box-self-insert-command-list?

leafarbelm commented 9 months ago

Thanks, that looks cool. Still, I'll be happier if scroll-other-window-down works. @leafbel, could you try adding scroll-other-window-down to eldoc-box-self-insert-command-list?

Sorry for the late reply, i tried to add it to my config and it work pretty well, thanks!

Here's my config:

(use-package eldoc-box
  :after eglot
  :custom
  (eldoc-idle-delay 0.5)
  :config
  (add-to-list 'eldoc-box-self-insert-command-list 'scroll-other-window)
  (add-to-list 'eldoc-box-self-insert-command-list 'scroll-other-window-down)
  (add-hook 'eglot-managed-mode-hook #'eldoc-box-hover-at-point-mode t))