justbur/emacs-which-key

Current command buffer overlaps help buffer

Closed this issue · 45 comments

fl00r commented

@justbur suggested (syl20bnr/spacemacs#3190) to report it here

See my screenshot

https://www.dropbox.com/s/gomptsvemjromgz/%D0%A1%D0%BA%D1%80%D0%B8%D0%BD%D1%88%D0%BE%D1%82%202015-09-29%2014.22.57.png?dl=0

System Info

  • OS: darwin
  • Emacs: 24.5.1
  • Spacemacs: 0.104.1
  • Spacemacs branch: master (rev. 2cfc9a5)
  • Distribution: spacemacs
  • Layers:
(clojure ruby markdown syntax-checking
         (git :variables git-gutter-use-fringe t)
         ruby-on-rails)

Thanks, have you changed the default which-key setup at all? Does this always happen or does it depend on how many emacs buffers you have showing? It looks like you are using the GUI. Is that right?

fl00r commented

It is pretty fresh installation. I've just added some layers (Clojure, Ruby) and that's all I've done. Nothing special.

It is GUI emacs from railwaycat/emacsmacport.

And it doesn't depend on buffers amount.

fl00r commented

Oh. After installing osx layer it fixed ^^

I suspect it's not fixed, because I don't see why that layer would affect this. It might depend on the size of the emacs frame. If you notice it happening again, can you run this and post the output here along with the corresponding picture?

(defun output-info ()
  (interactive)
  (message "max-dim: %s; sw-max-height-setting: %s; sw-max-height: %s; height of frame-root-window: %s"
           (which-key--popup-max-dimensions (window-width))
           which-key-side-window-max-height
          (which-key--height-or-percentage-to-height
           which-key-side-window-max-height)
          (window-total-height (frame-root-window))))

Thanks again. I hope it's fixed for you

fl00r commented

Sure.

Turning off osx layer didn't lead to this overlapping bug.

Ok, it's probably some edge case that will randomly occur now and then. I've never had it happen to me, so I'm going to need your help reproducing it.

EDIT: Not randomly really. I meant for particular frame size and key combinations

@bmag your help would be welcomed on this if you have any ideas

fl00r commented

Ok, I played with resizing and for this size it overlapped

max-dim: (5 . 123); sw-max-height-setting: 0.25; sw-max-height: 5; height of frame-root-window: 19

Is the frame being resized after the which-key buffer pops up for some
reason?

On Tue, Sep 29, 2015 at 9:35 AM, Peter Yanovich notifications@github.com
wrote:

https://www.dropbox.com/s/o0gkb4gkw1ee0le/%D0%A1%D0%BA%D1%80%D0%B8%D0%BD%D1%88%D0%BE%D1%82%202015-09-29%2016.35.29.png?dl=0


Reply to this email directly or view it on GitHub
#67 (comment)
.

fl00r commented

I've tried both cases - no difference. In some size it begins to overlap.

Ok, I think I'll have to gather some more information from you, because I can't reproduce the overlap here (unless I let the which-key buffer popup and then change the size of the whole emacs window).

When I get a chance I'll put together a function to get some more detailed debugging information. Thanks again for the help on this.

By the way, when max-dim was 5 here which-key should show at most 5 lines, and in your picture it showed 6 (the sixth is partially hidden), so there is a problem somewhere I just need more info to figure out where.

fl00r commented

Yes, I made that screenshot after some more resizes so it differs from function result, sorry)

fl00r commented

Now I have got this problem in full screen mode (not native)

max-dim: (12 . 179); sw-max-height-setting: 0.25; sw-max-height: 12; height of frame-root-window: 49

fl00r commented

I think I got the moment when it starts to overlap: when I split window with its fancy spacemacs split (layout-double-columns).

Ah, me too! Thanks that should be enough to go off of

Looks like a spacemacs issue after all. Try SPC t g (toggle golden ratio) and see if it resolves the problem.

fl00r commented

disabling golden ration helps

fl00r commented

But golden ratio rocks! :)

I can't figure out how to make golden-ratio respect which-key so I reported the issue upstream.

But which-key uses the minibuffer right ?
Did you test without the powerline too ?

I stopped using the minibuffer, because the paging stuff didn't play well with it. It's definitely golden-ratio. I can reproduce it every time.

Ok, generally to fix this kind of issues you can let bind golden-ratio-mode to nil while you construct your window.

(note: I find this let binding of golden-ratio-mode to nil awkward but the maintainers were not responsive to my proposition of having a variable golden-ratio-inhibit).

@syl20bnr see this there is an inhibit functions list now

I just can't get it to work ;-)

Ok, one more reason to have this ***** golden-ratio-inhibit variable...*sigh*
Anyway, can you test with the let binding I proposed while you create and show your window ?

Also couple it to an entry in golden-ratio-exclude-buffer-names

sure. btw, which-key is already excluded in that list.

Good, I'm confident that effectively inhibiting golden-ratio at the window showing time will solve your issue.

Works great! Thanks.

I don't understand why, but I'll push it anyways.

@fl00r This is fixed for me. Please re-open if you have any more trouble.

Should be available from melpa in a few hours or so

bmag commented

@justbur I was a bit late to this party, it seems. I'd guess golden-ratio only checks the current buffer against its excluding variables. which-key doesn't change the current buffer (not counting usages of with-current-buffer), so which-key's buffer isn't current when golden-ratio is called, hence excluding which-key's buffer from golden-ratio doesn't do anything.
Wrapping which-key--show-popup with with-current-buffer may have also solved this issue, but it could have other negative effects on window display (since the selected window's buffer won't be the current buffer), so I don't recommend it.

@bmag makes sense. I included you before it was clear that golden-ratio was the issue, because I thought maybe there was some issue in the display functions in which-key. Turns out everything was fine on this side

I added this line which prevented this call to balance-windows from messing with the which-key buffer, but something was still wrong. I gave up, and I'm not worried about it. @syl20bnr's suggestion worked fine.

Unfortunately not resolved on Windows 7 x64.

Are you sure that you have the correct which-key version ? Golden-ratio has
nothing to do with the OS.

Le jeudi 1 octobre 2015, BoomTheFace notifications@github.com a écrit :

Unfortunately not resolved on Windows 7 x64.


Reply to this email directly or view it on GitHub
#67 (comment)
.

-syl20bnr-

@syl20bnr we were talking on gitter. It's probably not the os, but the
version seems correct. Unless somehow there are multiple places on the
machines where it's installed and it's loading the wrong one?

On Thu, Oct 1, 2015 at 8:11 PM, Sylvain Benner notifications@github.com
wrote:

Are you sure that you have the correct which-key version ? Golden-ratio has
nothing to do with the OS.

Le jeudi 1 octobre 2015, BoomTheFace notifications@github.com a écrit :

Unfortunately not resolved on Windows 7 x64.


Reply to this email directly or view it on GitHub
<
#67 (comment)

.

-syl20bnr-


Reply to this email directly or view it on GitHub
#67 (comment)
.

@fl00r have you had any more trouble?

@BoomTheFace try with "powerline" and "spaceline" packages excluded.
Also restart spacemacs from scratch.

-syl20bnr-

On Thu, Oct 1, 2015 at 8:15 PM, Justin Burkett notifications@github.com
wrote:

@fl00r https://github.com/fl00r have you had any more trouble?


Reply to this email directly or view it on GitHub
#67 (comment)
.

@BoomTheFace I found an alternative way to fix this problem for me using this

(setq golden-ratio-inhibit-functions '((lambda () which-key--current-page-n)))

You could try that to see if it makes a difference

@justbur Do I just need to put that in the spacemacs/user-config function?

@justbur Looks like that took care of it.

dotspacemacs/user-init or dotspacemacs/user-config shouldn't matter

On Fri, Oct 2, 2015 at 12:53 PM, BoomTheFace notifications@github.com
wrote:

@justbur https://github.com/justbur Do I just need to put that in the
spacemacs/user-config function?


Reply to this email directly or view it on GitHub
#67 (comment)
.

@BoomTheFace I think this might be fixed for you now without using golden-ratio-inhibit-functions. Would you mind testing it for me with an up-to-date which-key?