abo-abo / ace-window

Quickly switch windows in Emacs
977 stars 87 forks source link

Window numbers or characters are missing sometimes #131

Closed seagle0128 closed 5 years ago

seagle0128 commented 6 years ago

I love ace-window, but experiencing some issues. e.g. sometimes the window numbers are missing as the screenshot below (1 and 2 missing). After switch to other window, they may be displayed again.

Another issue is the sequence of the window numbers are not always same as window-numbering. Any customization for that?

screen shot 2018-05-29 at 12 36 35 am
abo-abo commented 6 years ago

Please give me a reproducible scenario for when there's no window number.

seagle0128 commented 6 years ago

I don't know how to describe. These are my steps.

  1. Open Emacs with server-mode.
  2. C-x 2 and C-x 3 for couple of times.
  3. C-x o to switch window.

That's all. Then you may see the window numbers are missing perhaps, not all the time. I didn't figure out the pattern. Maybe it was impacted by other packages?

PS: My config is here. I removed ace-window for now. You can add ace-window to try.

seagle0128 commented 6 years ago

Update: I switch to switch-window a few days ago. In the same scenarios, it's stable and works well.

seagle0128 commented 6 years ago

I did some research today, and I found if popwin-mode is enabled, and sequence of the window number is incorrect. ace-window considers the new popwin is the newest one, and assign 2, actually it's the last one.

abo-abo commented 6 years ago

Hmm, I still can't do much without a reproduction scenario. Here's what I expect:

If there's a repro scenario, I can actually debug the issue to see where it goes wrong. I can't do much by looking at a screenshot, and I don't want to debug all the package interactions in your config.

seagle0128 commented 6 years ago

@abo-abo I found some clues. Hope they are helpful.

If I set faces of ace-window, it's easier to recreate the issue (but not 100%). Split more windows and try more times. I noticed :height > 1 may cause the issue easily. Perhaps the overlays are conflicted?

(custom-set-faces
   '(aw-leading-char-face
     ((t
       (:foreground "deep sky blue" :bold t :height 3.0)))))
abo-abo commented 6 years ago

I tried your custom-set-faces, I still can't reproduce. I'm sorry that you're getting an issue, but unless it's something reproducible I can't fix it.

seagle0128 commented 6 years ago

It's easy to reproduce in my envs, including both macOS 10.13.5 and Ubuntu 18.04 LTS, with GNU Emacs 26.1. I believe the issue also exists on Emacs 25.3.

I made a recording here. You can see, after customizing faces, the number 3 was missing, then came back. It's annoying! ace-window1

abo-abo commented 6 years ago

It's easy to reproduce in my envs

I still can't reproduce this. I tried make plain with your extra faces code, and splitting the windows the way you did.

I think in order to reproduce this more things are needed:

seagle0128 commented 6 years ago

Well, in my screen recording, emacs -Q to start the Emacs. Only one package ace-window is loaded. All codes are in the screen there. I attached below as well.

At first, I didn't eval custom-set-faces snippet, the numbers were displayed correctly. Then changed the faces, the number 3 was missing. C-x o again, all numbers were showed.

(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory))
(setq package-archives '(("gnu"   . "http://elpa.gnu.org/packages/")
                         ("melpa" . "http://melpa.org/packages/")))

(package-initialize)

(require 'ace-window)
(global-set-key [remap other-window] 'ace-window)

(custom-set-faces
 '(aw-leading-char-face
   ((t
     (:foreground "deep sky blue" :bold t :height 3.0)))))
abo-abo commented 6 years ago

Can you also add your (frame-parameters) and the point position when you called ace-window. Maybe also the scroll amount if it matters.

seagle0128 commented 6 years ago

I use this to get the information on Ubuntu 18.04. GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-05-29

(global-set-key [remap other-window]
                (lambda(arg)
          (interactive "p")
                  (message "%s" (frame-parameters))
                  (ace-window arg)))

When the issue happened, the output is

((parent-id . 16217870) (explicit-name) (display . :0) (icon-name) (outer-window-id . 71303491) (window-id . 71303495) (top . 132) (left . 912) (buried-buffer-list) (buffer-list *scratch*  *Minibuf-1* *Help*) (unsplittable) (modeline . t) (width . 80) (height . 36) (name . emacs@ubuntu) (environment) (sticky) (cursor-color . black) (background-mode . light) (display-type . color) (window-system . x) (z-group) (skip-taskbar) (visibility . t) (fullscreen) (no-accept-focus) (no-focus-on-map) (alpha) (scroll-bar-height . 0) (scroll-bar-width . 16) (cursor-type . box) (auto-lower) (auto-raise) (icon-type . t) (inhibit-double-buffering) (tool-bar-position . top) (wait-for-wm . t) (title) (buffer-predicate) (tool-bar-lines . 1) (menu-bar-lines . 1) (scroll-bar-background) (scroll-bar-foreground) (no-special-glyphs) (right-fringe . 8) (left-fringe . 8) (line-spacing) (screen-gamma) (border-color . black) (mouse-color . black) (background-color . white) (foreground-color . black) (horizontal-scroll-bars) (vertical-scroll-bars . right) (bottom-divider-width . 0) (right-divider-width . 0) (internal-border-width . 0) (border-width . 0) (font-parameter . Ubuntu Mono 13) (font . -DAMA-Ubuntu Mono-normal-normal-normal-*-17-*-*-*-m-0-iso10646-1) (font-backend xft x) (override-redirect) (undecorated) (parent-frame) (minibuffer . t))

After

((parent-id . 16217870) (explicit-name) (display . :0) (icon-name) (outer-window-id . 71303491) (window-id . 71303495) (top . 132) (left . 912) (buried-buffer-list *Completions*) (buffer-list *scratch*  *Minibuf-1* *Messages*  *Minibuf-0* *Help*) (unsplittable) (modeline . t) (width . 80) (height . 36) (name . emacs@ubuntu) (environment) (sticky) (cursor-color . black) (background-mode . light) (display-type . color) (window-system . x) (z-group) (skip-taskbar) (visibility . t) (fullscreen) (no-accept-focus) (no-focus-on-map) (alpha) (scroll-bar-height . 0) (scroll-bar-width . 16) (cursor-type . box) (auto-lower) (auto-raise) (icon-type . t) (inhibit-double-buffering) (tool-bar-position . top) (wait-for-wm . t) (title) (buffer-predicate) (tool-bar-lines . 1) (menu-bar-lines . 1) (scroll-bar-background) (scroll-bar-foreground) (no-special-glyphs) (right-fringe . 8) (left-fringe . 8) (line-spacing) (screen-gamma) (border-color . black) (mouse-color . black) (background-color . white) (foreground-color . black) (horizontal-scroll-bars) (vertical-scroll-bars . right) (bottom-divider-width . 0) (right-divider-width . 0) (internal-border-width . 0) (border-width . 0) (font-parameter . Ubuntu Mono 13) (font . -DAMA-Ubuntu Mono-normal-normal-normal-*-17-*-*-*-m-0-iso10646-1) (font-backend xft x) (override-redirect) (undecorated) (parent-frame) (minibuffer . t))

screenshot at 2018-07-06 11-40-49

ofenerci commented 6 years ago

I have Emacs 26.1 and the windows doesn't show the numbers at all.

abo-abo commented 5 years ago

Thanks, please test.

seagle0128 commented 5 years ago

The issue still exists with the latest version.

image

abo-abo commented 5 years ago

@seagle0128 Thanks, please test again.

seagle0128 commented 5 years ago

It works and no issue found so far. Than you, @abo-abo !

seagle0128 commented 5 years ago

Update: it seems the position is below top-left now.

abo-abo commented 5 years ago

Update: it seems the position is below top-left now.

That's the trade-off, unfortunately. It's a work-around of an Emacs display bug, where the overlay on the top line may not be displayed if it has a height bigger than the height of the top line.

Suggestions or patches for better work-arounds are welcome, but I think I can't do much more here as it is now.

rswgnu commented 5 years ago

I am using: Package-Version: 20190210.1648 and I still see this problem whenever the buffer in a window is horizontally scrolled so that the left-most characters are not visible. ace-window should account for (window-hscroll) and place the leading-char within a visible part of the window. Can that be done?

rswgnu commented 5 years ago

Here's a patch that I tested with 81 windows and it displayed the leading-char properly in all of them except buffers receiving output during the aw--lead-overlay function call since the output may scroll the overlay point outside the window's visible range, e.g. the Messages buffer. Prior to this patch maybe 10% of the windows failed to display the overlay character; now it is closer to 1%.

aw-diff.txt