eldoc-box icon indicating copy to clipboard operation
eldoc-box copied to clipboard

Childframe covers company popup

Open casouri opened this issue 6 years ago • 29 comments

From #11

casouri avatar Jun 06 '19 13:06 casouri

@andreyorst I made a patch and it seems to work for the simplest case. Let's use it for a while and see if other problems occur.

casouri avatar Jun 06 '19 13:06 casouri

great! will it be available on melpa or should I install it from git and use some branch to test?

andreyorst avatar Jun 06 '19 17:06 andreyorst

Melpa is up to date, you can just use that. 😄

casouri avatar Jun 07 '19 07:06 casouri

Thanks, I've tried that, I think it's nice workaround, but not as final solution, since it simply displays eldoc as it would without your package, and I've installed your package to stop that behavior, because it visually moves my buffers when shown or hidden. Another possible workaround would be to display it not at point, like when eldoc-box-hover-at-point-mode is disabled, which would be nicer, since it still uses childframes, but positions those in non distracting way.

I wonder I you can borrow some ideas from https://github.com/expez/company-quickhelp to display eldoc at point, but position it correctly accordingly to company.

andreyorst avatar Jun 07 '19 10:06 andreyorst

Sounds like a good idea. You can try the patch here: https://github.com/casouri/eldoc-box/tree/cover-company-fix

However, this would cover company-quickhelp if it is enabled, what should we do in that case? Judging from the source of company-quickhelp, there's no good way to get the geometry of the pos-tip it uses.

casouri avatar Jun 07 '19 12:06 casouri

However, this would cover company-quickhelp if it is enabled, what should we do in that case? Judging from the source of company-quickhelp, there's no good way to get the geometry of the pos-tip it uses.

I guess in this way eldoc-box should disable at-point hovering and fallback to posframe at default position.

Sounds like a good idea. You can try the patch here: https://github.com/casouri/eldoc-box/tree/cover-company-fix

I'm getting these errors:

error in process filter: eldoc-box--default-at-point-position-function-1: Symbol’s value as variable is void: pos-in-window
error in process filter: Symbol’s value as variable is void: pos-in-window

andreyorst avatar Jun 07 '19 15:06 andreyorst

I guess in this way eldoc-box should disable at-point hovering and fallback to posframe at default position.

That's a good idea. Should we just let users do that? I.e., don't use at-point-hover when you also use company-quickhelp.

I'm getting these errors:

I don't get these errors. And my patch didn't touch that part of the code. Could you verify if you are at f292d28712b38c4c94e5bb9fcf3788f19b83dc6d?

casouri avatar Jun 08 '19 02:06 casouri

That's a good idea. Should we just let users do that? I.e., don't use at-point-hover when you also use company-quickhelp.

yes, I guess.

I don't get these errors. And my patch didn't touch that part of the code. Could you verify if you are at f292d28?

I've just switched branch and copied file contents, since I don't know how to install packages from git with use-package

andreyorst avatar Jun 08 '19 04:06 andreyorst

That's strange, I cloned the branch fresh and loaded the file, and still don't see the error.

casouri avatar Jun 08 '19 14:06 casouri

yes, If I clone and load it works fine.

andreyorst avatar Jun 08 '19 16:06 andreyorst

Tried your package again with Mate (still waiting when Gnome Shell related issue will be fixed) and I think this issue is fixed and can be closed. Eldoc Box shows up correctly near the company popup and follows cursor as you type.

However I have another thoughts about eldoc-box behavior, and I'll describe those in another issue. Thanks!

andreyorst avatar Oct 02 '19 17:10 andreyorst

Cool

casouri avatar Oct 03 '19 05:10 casouri

https://github.com/casouri/eldoc-box/issues/21#issuecomment-537955462

Ah, finally figured out how to reproduce this issue: Here I change the size of treemacs buffer. If you toggle these two images you'll notice that eldoc-box position is not changed between those [1], [2]

display-line-number-mode also doesn't affect eldoc-box position: [1], [2]

Disabling treemacs and display-line-numbers-mode fixes the issue. Actually any left window breaks positioning in right window for some reason:

  • imenu-list buffer affects position of eldoc-box: image

  • Buffer on the left affects position of eldoc-box in right buffer: image

@casouri can you reopen this issue?

andreyorst avatar Oct 10 '19 11:10 andreyorst

Can be reproduced without any configuration in emacs -q after evaluating

(progn (package-initialize) (require 'eldoc-box) (require 'eglot) (require 'company))

Enabling eglot, company-mode, eldoc-box-hover-at-point-mode and display-line-numbers-mode produces this result:

image

This is Emacs 27.

andreyorst avatar Oct 10 '19 11:10 andreyorst

Thanks for your work. I’ll look into it.

casouri avatar Oct 10 '19 20:10 casouri

The line-numbers-mode problem should go away now.

casouri avatar Nov 02 '19 04:11 casouri

Since you use Linux, could you tell me whether the y-position is off when you turn on tool-bar-mode?

casouri avatar Nov 02 '19 04:11 casouri

@casouri I can't check, since I'm also experiencing this issue #24

andreyorst avatar Nov 02 '19 09:11 andreyorst

Changing code like this:

-  (let* ((pos (pos (posn-at-point point window)))
+  (let* ((pos (posn-at-point point window))
          (x-y (posn-x-y pos))
          (window (posn-window pos))
          (edges (window-body-pixel-edges window)))

makes it work, but position is not correct:

image image

As for tool-bar-mode it affects the position in a correct way. E.g. the position on screenshots above do not change with or without tool bar

andreyorst avatar Nov 02 '19 11:11 andreyorst

Yet it seems that this positioning problem is shared among other plugins like company-box. So this may be GNOME Shell related. Although old code doesn't seem to have that problem.

andreyorst avatar Nov 02 '19 11:11 andreyorst

Ok, here's what I know. display-line-numbers-mode invoked problem because it is squeezed into the window, therefore, the x value returned by company is off the width of the line numbers. My last fix fixes that problem (for me). I'm not sure why imenu-list has a problem - it seems to use a regular window and it worked fine for me. Maybe you mean the childframe didn't automatically update position when imenu-list popup up?

casouri avatar Nov 02 '19 13:11 casouri

It seems that the problem with the leftmost windows is fixed as well

I just mean that instead of displaying under the cursor, box is displayed over the current line

image (cursor is after args|)

andreyorst avatar Nov 02 '19 13:11 andreyorst

Yes, that's what I'm trying to solve. That happens when I endable tool-bar-mode. You enabled tool-bar-mode, no?

casouri avatar Nov 02 '19 13:11 casouri

Tool bar mode doesn't affect position in my case. Both on and off the position is the same for any box

andreyorst avatar Nov 02 '19 14:11 andreyorst

Found it. global-tab-line-mode is the root of the issue. It's the same as header-line but uses additional tab-line area added in Emacs 27

andreyorst avatar Nov 02 '19 14:11 andreyorst

I see, let me try to figure out how to get the height of the tab-line.

casouri avatar Nov 02 '19 14:11 casouri

I think I got it for the most part. gloabl-tab-bar-line doesn't create problem now at least. The positions in a window/frame in Emacs is such a mess...

casouri avatar Nov 02 '19 14:11 casouri

BTW, could you check if the childframe is off by 1 pixel? I observed it on my machine:

Screen Shot 2019-11-02 at 10 37 22 AM

Well maybe that's not exactly 1 pixel, but you know what I mean.

casouri avatar Nov 02 '19 14:11 casouri

I think I got it for the most part. gloabl-tab-bar-line doesn't create problem now at least. The positions in a window/frame in Emacs is such a mess...

You can look at this library. It has no problems with resize in Gnome and positioning as far as I can tell.

BTW, could you check if the childframe is off by 1 pixel? I observed it on my machine:

Screen Shot 2019-11-02 at 10 37 22 AM

Well maybe that's not exactly 1 pixel, but you know what I mean.

image

It seems there's no such problem on my machine.

andreyorst avatar Nov 02 '19 15:11 andreyorst