erikw / tmux-powerline

⚡️ A tmux plugin giving you a hackable status bar consisting of dynamic & beautiful looking powerline segments, written purely in bash.
BSD 3-Clause "New" or "Revised" License
3.36k stars 508 forks source link

Tmux status line updates appear *below* the status line. #425

Closed cheilman closed 1 month ago

cheilman commented 1 month ago

Running tmux with tmux-powerline via tpm, on CentOS9. Shell is zsh 5.9, bash is 5.1.8, tmux is 3.4. Tried both with my config and default (no config.sh file). When the status line initially renders it all looks good, but then immediately updates write their characters on the line below the status bar. For things like load and time, when the number updates the update happens on the next line after the status bar. See screenshots.

Screenshot 2024-05-21 at 12 12 25 PM Screenshot 2024-05-21 at 12 39 25 PM Screenshot 2024-05-21 at 12 41 27 PM
cheilman commented 1 month ago

Forgot to add. I'm on MacOS Sonoma 14.4.1, ssh'd into the linux machine. Terminal is iTerm2 3.5.0. I looked at the setting for "Ambiguous characters are double-width" and it is disabled like I saw recommended in other issues.

cheilman commented 1 month ago

Interestingly, the same config running on the same macbook, same iterm2, but running locally instead of ssh'd into a linux machine works fine.

Screenshot 2024-05-21 at 1 01 48 PM
$ zsh --version && bash --version && tmux -V
zsh 5.9 (arm-apple-darwin22.5.0)
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin23)
Copyright (C) 2007 Free Software Foundation, Inc.
tmux 3.4
xx4h commented 1 month ago

Interesting. So just to be sure i got it correctly, you're using ssh from your MacOS Sonoma 14.4.1 to connect to a CentOS 9 system. On the CentOS 9 system you have zsh 5.9, bash 5.1.8 and tmux 3.4?

Some first ideas and things to try to narrow down the issue:

cheilman commented 1 month ago

Correct, trying with a newly opened iTerm2.

$ zsh --version && bash --version && tmux -V
zsh 5.9 (x86_64-redhat-linux-gnu)
GNU bash, version 5.1.8(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
tmux 3.4
  1. I'm not sure where the tmux comes from, my company has some internal package repos so it's possible they've built 3.4 for centos 9 instead of normal upstream repos. I don't have access to 3.2a.
  2. No, with no tmux.conf and the default status line it updates correctly.
  3. The initial display is correct, the extra line appears with the first update and it only contains characters that changed (like digits from the load, or seconds).
  4. Using terminal.app (version 2.14) does not have this issue, updates look correct. However, I don't have the right fonts installed there so the status line doesn't look right (and I'm not sure if that impacts other things). Screenshot 2024-05-22 at 11 50 50 AM
  5. Turns out that I had my tmux command aliased (tmux='LC_CTYPE=POSIX tmux -ul2'), but removing that and calling /usr/bin/tmux directly has the same behavior.

Going back to the terminal.app question, I got the fonts working and it's still good, so probably a setting within iTerm2 somewhere -- but that's related to the centos host?
Screenshot 2024-05-22 at 11 53 28 AM

I'm setting terminal within my tmux.conf (set -g default-terminal "tmux-256color") but commenting that line doesn't change things, it still happens in iTerm2.

Here's a pretty minimal tmux.conf that still reproduces the issue:

❯ cat .tmux.conf                                                                                                                                                                                                                            ─╯
───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: .tmux.conf
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ #
   2   │ # TMux Config File
   3   │ #
   4   │
   5   │ # Update the prefix to be like (my) screen
   6   │ set -g prefix C-w
   7   │ unbind C-b
   8   │ bind C-w send-prefix
   9 _ │
  10   │ # Status line settings
  11   │ set -g status on
  12 _ │ set -g status-interval 1
  13   │
  14   │ # Tmux Plugins
  15   │ set -g @plugin 'tmux-plugins/tpm'
  16   │ set -g @plugin 'erikw/tmux-powerline'
  17 _ │
  18   │ # Initialize TPM (must stay at bottom)
  19   │ run-shell -b "$HOME/.tmux/plugins/tpm/tpm"
  20   │
───────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

That was an aggressive update interval, but bumping it to 10s didn't change anything.

Locale in environment is:

LC_ALL=en_US.utf8
LC_CTYPE=en_US.utf8
xx4h commented 1 month ago

Going back to the terminal.app question, I got the fonts working and it's still good, so probably a setting within iTerm2 somewhere -- but that's related to the centos host?

Did you try a different profile (new one with defaults) in iTerm2?

cheilman commented 1 month ago

I have no idea why, but a clean profile worked. I even dumped the two profiles to json and diffed them and there are no significant differences...

❯ diff Downloads/clean-sorted.json Downloads/default-sorted.json
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
renamed: Downloads/clean-sorted.json to Downloads/default-sorted.json
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@ default-sorted.json:99 @
        "Red Component": 1,
        "Blue Component": 1
    },
    "Bound Hosts": [],
    "Character Encoding": 4,
    "Close Sessions On End": true,
    "Columns": 80,
@ default-sorted.json:126 @
        "Red Component": 0.7333333492279053,
        "Blue Component": 0.7333333492279053
    },
    "Guid": "3E2914B0-25C9-4282-8D79-8C814ED8E42A","39730D5E-561C-48EA-8597-5C3CBE741EF5",
    "Horizontal Spacing": 1,
    "Idle Code": 0,
    "Jobs to Ignore": [
@ default-sorted.json:298 @
        }
    },
    "Mouse Reporting": true,
    "Name": "Clean","Default",
    "Non Ascii Font": "Monaco 12",
    "Non-ASCII Anti Aliased": true,
    "Normal Font": "MesloLGS-NF-Regular 12",
@ default-sorted.json:324 @
        "editor": "com.github.atom"
    },
    "Send Code When Idle": false,
    "Shortcut": "","T",
    "Show Status Bar": false,
    "Silence Bell": false,
    "Status Bar Layout": {

That fixed my issue through ssh, thanks for the debugging help!

I also tried using mosh for connecting, and that's still broken, but I can work with just ssh for now. I suspect mosh is introducting some kind of terminfo issue but I haven't spent time debugging. Good enough for now :). Thank you again!