abo-abo / ace-window

Quickly switch windows in Emacs
970 stars 86 forks source link

Overlay is not displayed when cursor is in the bottom of the window #176

Closed pkryger closed 5 years ago

pkryger commented 5 years ago

I saw a couple of times that the overlay is not displayed in some windows. The only consistent way I can reproduce it is when the point is in one of the bottom lines and the overlay to be displayed wouldn't fit in the 'first' line. The issue is more pronounced when the leading char is bigger than 1.0.

Reproduction instruction.

  1. Start with a fresh emacs then:
    (add-to-list 'package-archives (cons "melpa" "http://melpa.org/packages/") t)
    (package-initialize)
    (package-refresh-contents)
    (package-install 'ace-window)
    (global-set-key (kbd "M-o") #'ace-window)
    (custom-set-faces
    '(aw-leading-char-face ((t (:foreground "red" :bold t :height 2.5)))))
    (newline 20)
  2. Split window: C-x 2, C-x3
  3. Set the points as in the picture (I used mouse): before
  4. Hit: M-o. Result: after

Note that I'm using emacs-mac from Mituharu (https://bitbucket.org/mituharu/emacs-mac/src/master/). Not sure if it is possible to scroll half of the line on other versions.

abo-abo commented 5 years ago

Please test if this was fixed in #175.

pkryger commented 5 years ago

I started fresh, then followed the steps from the reproduction. After that I overwrote ace-window.el:

$ git rev-parse HEAD
ab0db6a2c3b1c3d9240667df1e1d9cafa2756376
$ cp ace-window.el ../../.emacs.d/elpa/ace-window-20190522.1544/ace-window.el

I opened the file and I did eval-defun on the new version of the aw--lead-overlay from ab0db6a. But it didn't help. The overlay character is still missing for windows where the point is in the bottom area. Please note where the points are in the upper windows:

before2

After hitting M-o the overlay is not displayed:

after2
abo-abo commented 5 years ago

Note that I'm using emacs-mac from Mituharu (https://bitbucket.org/mituharu/emacs-mac/src/master/). Not sure if it is possible to scroll half of the line on other versions.

This could be the cause. Can you try to reproduce with a different Emacs version?

pkryger commented 5 years ago

That sounded like a reasonable thing to try. I did so. Unfortunately this is still the case. I replied the experiment with Emacs For Mac OS X. Apparently this version cannot display part of the line. Yet the issue remains. Both without and with the ab0db6a patch. Screenshots with the patch applied via eval-defun.

before after

abo-abo commented 5 years ago

ace-window-176-1

I can't reproduce the issue on GNU Linux, Emacs 26.2. Maybe we can solve it later by using posframe instead of overlays.

pkryger commented 5 years ago

I just want to confirm: did you have points in the very last line visible in all windows?

BTW: The asdf for selection -> my next tweak 👍

abo-abo commented 5 years ago

I just want to confirm: did you have points in the very last line visible in all windows?

Yes.

pkryger commented 5 years ago

I've just done a quick test on a Docker image with ubuntu:unstable and their emacs. X11 forwarded to xQuartz. This time it was GTK (I guess) that drew the frame. Still can't see overlays when I start with the point in the bottom of a window 🤯:

before after

I can share the Docker image if you want.

abo-abo commented 5 years ago

ace-window-176-2

I tried using the same window config and point positions. Still can't reproduce.

pkryger commented 5 years ago

@abo-abo Could you try with the clean setup? Like literally no other packages nor .emacs? Or on a different version of emacs (i.e., on ubuntu:unstable Docker)? I can see your points 'jump' quite high compared to mine (in frames a and d). They seem to be about 1/3 from the top, unlike mine that appears to be in the middle of the frame. This happens even if I make the frame full screen on macOS: before after Note: the overlay in all frames appears when the point before calling C-u is two or more lines above the last visible line (C-u 2 C-p). But it does not when it is in the last one or just above.

One extra observation: when I make the leading char face height fairly small, so it fits into the first displayed line the issue is gone. However, workaround like this defeats the fact that I want them to be very visible and easily distinguishable.

abo-abo commented 5 years ago

There's a way to load ace-window without config from this repo.

make plain

I tried this one and I still can't reproduce. I add the screenshots of before and after. ace-window-176-2 ace-window-176-3

pkryger commented 5 years ago

Thanks for the 'before' shot. I can see that the points in that shot in windows 1 and 2 are in the firtst visible line. Did you move them (i.e, with a mouse click, so the text won't scroll) to the last visible line? I marked example positions, that I use to reproduce, with red arrows: 58411285-3e391200-8074-11e9-8749-b338bba83f37

abo-abo commented 5 years ago

Thanks for the explanation, I was finally able to reproduce. See the commit for the reason. Please test if this is fixed.

pkryger commented 5 years ago

Thank you - the 138a80c indeed fixes this issue.