Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problematic positioning with multiple windows #50

Open
moberer opened this issue Aug 4, 2022 · 1 comment
Open

problematic positioning with multiple windows #50

moberer opened this issue Aug 4, 2022 · 1 comment

Comments

@moberer
Copy link

moberer commented Aug 4, 2022

Simplest way to reproduce:
Open a source file, open treemacs, hover over a function.

When hovering over a function in the left window, the box appears on the top-right. (Which is expected)
When hovering over a function in the right window, the box appears on the top-left.
This is - as far as I can tell from the source code - intentional.

Firstly, the objective problem with this:
While using e.g. treemacs or neotree, they put a small frame on the left side of the window.
Because these frames are so narrow, the displayed eldoc-box 'spills over' into the main window and hides significant amounts of code.
This means one is pretty much unable to edit the first ~15 lines of any source file.

Since I always have treemacs open, this led me to assume this package was completely broken when I first used it.
Only after reading and trying to understand the source-code, I could understand what was going on. (Since this behavior isn't really documented).

Secondly, a more subjective point:
While the current behavior is well-intentioned, I think there is also some value to be found in placing the box always in the same position. This way the user knows where to expect it, and doesn't have to 'hunt it down' with their eyes every time.

For my personal purposesI have made an adaption to the existing eldoc-box--default-upper-corner-position-function, making it always display in the top right corner:

(defun eldoc-box--default-upper-right-corner-position-function (width _)
  (pcase-let ((`(,offset-l ,offset-r ,offset-t) eldoc-box-offset))
    (cons (- (frame-outer-width (selected-frame)) width offset-r)
               offset-t)))

My suggestion would be to make this behavior the default, as it is much less likely to frustrate or confuse new users.
The currently-default behavior could be made an opt-in to those users, who still like it.

@casouri
Copy link
Owner

casouri commented Aug 24, 2022

Thanks. And sorry for the delay. Fixing the box at top-right will block the right window for those who uses two side-by-side windows. So I don't think it is a strict improvement of the current default. I'll think of a smarter way of positioning the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants