ema2159 / centaur-tabs

Emacs plugin aiming to become an aesthetic, modern looking tabs plugin
GNU General Public License v3.0
746 stars 50 forks source link

spaceline flicker with 2 or more windows #18

Closed mpanarin closed 4 years ago

mpanarin commented 5 years ago

Thanks for the awesome package!

I encountered an issue: on emacs27, and spacemacs on develop branch. When more than one window is open with tabs on, spaceline starts to flicker with every line change. Can be connected to the similar issue that existed in helm with focus? https://github.com/emacs-helm/helm/issues/1593

ema2159 commented 5 years ago

Hi, It may have to do with both packages using powerline. I personally use doom-modeline so I haven't encountered this issue, but it most likely has to do with that. I'll try to investigate, and if you find a solution don't be afraid of submitting a PR!

ema2159 commented 5 years ago

Please show me your centaur-tabs config! What I think may be causing the problem is the header-line face.

mpanarin commented 5 years ago

Just tried switching to doom modeline, just to check. Still have similar issue with modeline not being highlighted and cursor flashing sometimes in second window. This definitely looks like focus switching. Maybe its not centaur-tabs directly though :\

my config:

(use-package centaur-tabs
    :demand
    :config
    (centaur-tabs-mode t)
    (setq centaur-tabs-style "bar")
    (setq centaur-tabs-height 32)
    (setq centaur-tabs-set-icons t)
    (setq centaur-tabs-set-bar 'over)
    (setq centaur-tabs-set-close-button nil)
    (setq centaur-tabs-cycle-scope 'tabs)
    (centaur-tabs-group-by-projectile-project)
    (centaur-tabs-mode t)
    (defun centaur-tabs-hide-tab (x)
      (let ((name (format "%s" x)))
          (or
         (window-dedicated-p (selected-window))
           (string-prefix-p "*epc" name)
           (string-prefix-p "*helm" name)
           (string-prefix-p "*Helm" name)
           (string-prefix-p "*spacemacs*" name)
           (string-prefix-p "*Messages*" name)
           (string-prefix-p "*Compile-Log*" name)
           (string-prefix-p "*which-key*" name)
           (string-prefix-p "*lsp" name)
           (string-prefix-p "magit" name)
           )))
    :hook (
     (dashboard-mode . centaur-tabs-local-mode)
     (treemacs-mode . centaur-tabs-local-mode)
     (spacemacs-buffer-mode . centaur-tabs-local-mode)
     (term-mode . centaur-tabs-local-mode)
     (calendar-mode . centaur-tabs-local-mode)
     (org-agenda-mode . centaur-tabs-local-mode)
     (helpful-mode . centaur-tabs-local-mode)
     (dired-mode . centaur-tabs-local-mode)
     (zone-mode . centaur-tabs-local-mode)
     (helm-mode . centaur-tabs-local-mode))
    :bind
    ("C-<prior>" . centaur-tabs-backward)
    ("C-<next>" . centaur-tabs-forward)
    ("C-c t" . centaur-tabs-counsel-switch-group)
    (:map evil-normal-state-map
            ("g l" . centaur-tabs-forward)
            ("g h" . centaur-tabs-backward)
            ("SPC b n" . centaur-tabs-forward)
            ("SPC b p" . centaur-tabs-backward))
    )
ema2159 commented 5 years ago

Dammit! I thought the (centaur-tabs-headline-match) function was the culprit, it seems its some other problem. I don't use Spacemacs so it would be hard to solve. You could ask them to try to check what's going on

ema2159 commented 5 years ago

Please keep me updated with this and let me know how I can help!

mpanarin commented 5 years ago

Yep, sure. Will do some more testing on coming days.

Another thing I noticed, is that it doesn't flicker when tabs from two different groups are present. ex. In window 1 tabs from project1 (projectile) and in window 2 tabs from project2. Maybe this will give you some hint. I'll also try to check on the out-of-the box spacemacs config to rule out some of mine configurations. Maybe, if it is still flickering, you could try check it?

Because I am very-very limited in my elisp knowledge :\

Thanks in advance!

mpanarin commented 5 years ago

Aaand yes. Issue is reproducable on basic spacemacs install. If you have time, can you please check?

Here is the minimal spacemacs config https://gist.github.com/mpanarin/f6cacb692b422c8427ed17d14ad0b163

ema2159 commented 5 years ago

Do you know other people that use spacemacs and centaur-tabs too? This in order to see if the problem is with spacemacs compatibility so I can open an issue there

mpanarin commented 5 years ago

Yep, have a friend with the exact same issues as me image In this situation the right window has spaceline grayed out all the time (like when the window is not focused) and on the left side spaceline will flicker when moving cursor between lines (and especially on the empty lines).

cburroughs commented 5 years ago

I at least one of the behaviors described in the linked spacemacs ticket -- pressing the up key with a vertical split causes the modeline to appear unfocused -- also happens with doom-modeline.

Steps:

ema2159 commented 4 years ago

Sorry for the incredibly long delay, I think I found a decent solution for this problem, although I would like you to test it when you can (if you still use this package). I used a rather simple solution. I added a run-idle-timer to the function that's hooked to the after-changes-function to prevent the tabs from being recalculated each time the user types, undos or anything. The changes will be merged on master soon.

ema2159 commented 4 years ago

Fixed in 3658efc.

mpanarin commented 4 years ago

@ema2159
Hi, thanks for spending more time on this. Your fix didn't help though :\

Some time ago I was debugging the issue and the problem seems that functions like with-temp-buffer for some reason trigger the buffer-list-update-hook(but it actually shouldn't) that triggers (force-mode-line-update). Never had the time to dig further into this though. Maybe I'll try to check it this weekends.

ema2159 commented 4 years ago

Hmmmm, that info actually helps me to solve this and #83. I'll try to fix it as soon as possible. I'm trying to fix as much as possible from the package before starting to support Emacs 27 which will come with a bunch of nice features.

mpanarin commented 4 years ago

Just for the info, I am on emacs 28. Though I had this issue with emacs 26 and 27 as well.

ema2159 commented 4 years ago

@mpanarin now, finally, it should be solved. The solution wasn't trivial and I needed the help of @hlissner to solve it. Please test it in the Spacemacs environment and tell me if it works! In Vanilla Emacs it's fixed.

mpanarin commented 4 years ago

@ema2159 Oh my god, yes! This fixed the issue completely )

Thanks! Guess I'll start my slow transition back from tab-line-mode )

ema2159 commented 4 years ago

Awesome! Soon I'll try to support Emacs's 27 tab-line and some of its functionalities like window based tab groups soon.