tmuxp icon indicating copy to clipboard operation
tmuxp copied to clipboard

Outputs % after every command in some panes

Open pjrulez opened this issue 6 years ago • 22 comments

Just installed and playing around with a configuration. Running in gnome terminal with zsh and tmux. This is the configuration of the 1st window where issue appears:

session_name: OMG
start_directory: /home/pj
windows:
- focus: 'true'
  layout: 814f,190x48,0,0{95x48,0,0,0,94x48,96,0[94x24,96,0,1,94x23,96,25,2]}
  options:
    automatic-rename: 'off'
    monitor-activity: 'off'
    remain-on-exit: 'on'
  panes:
  - focus: 'true'
    shell_command:
    - l.
  - screenfetch
  - fortune | cowsay
  window_name: TERM

The issue is, when starting tmux session with "tmuxp load OMG" the 1st and 2nd pane display "%" after each issues command. Happens when the session is loaded with "l." and "screenfetch" and for every command issues afterward. Strangely the 3rd pane issuing shell_command: "fortune | cowsay" doesn't display "%" after the command, nor after any next command.

This doesn't occur ever if I start tmux manually in any pane or any window. It is possible to kill the troublesome panes and create new splits and the issue is gone. But that nullifies tmuxp's benefits if I have to remake whole 1st window everytime I open this session.

Any ideas why this would occur?

Example is displayed in this https://s14.postimg.org/ul2tnsu75/tmuxp_Issue_Screenshot_from_2018-03-13_19-28-23.png.

Information about my system: Python version: python --version Python 2.7.13 python3 --version Python 3.5.3 (installed using pip3) system PATH: echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin/:/home/pj/bin/:/home/pj/Applications/cava/:/home/pj/.local/bin/:/sbin/:/home/pj/bin/:/home/pj/Applications/c ava/:/home/pj/.local/bin/ (after seeing this I realized my /etc/zsh/zshenv gets sourced twice? This is the troubling line: export PATH=$PATH:/sbin/:$HOME/bin/:$HOME/Applications/cava/:$HOME/.local/bin/, but I don't think this is causing my issue. tmux version: tmux -V tmux 2.3 tmuxp version: tmuxp --version tmuxp 1.4.0 tmux path: which tmux tmux: aliased to _zsh_tmux_plugin_run tmuxp path: /home/pj/.local/bin//tmuxp (I have no idea what's wrong with "//" here. tmuxp executable is located in the /home/pj/.local/bin/ directory) libtmux version: can't find libtmux. shell: chsh Login Shell [/usr/bin/zsh]: output of tmux list-sessions: tls OMG: 5 windows (created Tue Mar 13 19:48:30 2018) [171x42] (attached) XXX: 5 windows (created Tue Mar 13 19:24:28 2018) [171x42] (XXX is the manually fixed version I keep running with resurrect and continuum tmp plugins) tmux list-windows:

`tmux list-windows
1: TERM*M (3 panes) [171x42] [layout 5742,171x42,0,0{85x42,0,0,38,85x42,86,0[85x21,86,0,39,85x20,86,22,40]}] @19 (active)
2: SYS (2 panes) [171x42] [layout 987f,171x42,0,0{112x42,0,0,41,58x42,113,0,42}] @20
3: CMUS (2 panes) [171x42] [layout 9882,171x42,0,0{112x42,0,0,43,58x42,113,0,44}] @21
4: WMON (2 panes) [171x42] [layout 9885,171x42,0,0{112x42,0,0,45,58x42,113,0,46}] @22
5: MC- (2 panes) [171x42] [layout 9888,171x42,0,0{112x42,0,0,47,58x42,113,0,48}] @23

tmux list-panes:

tmux list-panes 
1: [85x42] [history 1/20000, 43 bytes] %38
2: [85x21] [history 4/20000, 460 bytes] %39
3: [85x20] [history 2/20000, 146 bytes] %40 (active)

output of tmux show-options -g:

tmux show-options -g                                                                                                                                             
@batt_remain_short "true"                                                                                                                                                  
@continuum-boot "on"                                                                                                                                                       
@continuum-restore "on"                                                                                                                                                    
@continuum-save-last-timestamp "1520967267"                                                                                                                                
@plugin "tmux-plugins/tmux-battery"                                                                                                                                        
@resurrect-restore-script-path "/home/pj/.tmux/plugins/tmux-resurrect/scripts/restore.sh"                                                                                  
@resurrect-save-script-path "/home/pj/.tmux/plugins/tmux-resurrect/scripts/save.sh"                                                                                        
@resurrect-strategy-irb "default_strategy"                                                                                                                                 
assume-paste-time 1                                                                                                                                                        
base-index 1                                                                                                                                                               
bell-action none                                                                                                                                                           
bell-on-alert off                                                                                                                                                          
default-command ""                                                                                                                                                         
default-shell "/usr/bin/zsh"                                                                                                                                               
destroy-unattached off                                                                                                                                                     
detach-on-destroy on                                                                                                                                                       
display-panes-active-colour blue
display-panes-colour brightred
display-panes-time 1000
display-time 750
history-limit 20000
key-table "root"
lock-after-time 1800
lock-command "lock -np"
message-command-style fg=yellow,bg=black
message-style fg=brightred,bg=black
mouse on
prefix C-b
prefix2 C-a
renumber-windows on
repeat-time 220
set-remain-on-exit on
set-titles on
set-titles-string "#T - #W"
status on
status-interval 2
status-justify left
status-keys vi
status-left "#{?client_prefix,#[fg=colour254]#[bg=colour31]#[bold]#[noitalics]#[nounderscore],#[fg=colour16]#[bg=colour254]#[bold]#[noitalics]#[nounderscore]} #S #{?client_prefix,#[fg=colour31],#[fg=colour254]}#[bg=colour233]#[nobold] #(env $POWERLINE_COMMAND $POWERLINE_COMMAND_ARGS tmux left --width=`tmux display -p '#{client_width}'` -Rwidth_adjust=`tmux show-options -g stat
us-right-length | cut -d' ' -f2` -R pane_id="`tmux display -p '#D'`")"
status-left-length 20
status-left-style default
status-position bottom
status-right "#(/home/pj/.tmux/plugins/tmux-continuum/scripts/continuum_save.sh)#(env "$POWERLINE_COMMAND" $POWERLINE_COMMAND_ARGS tmux right -R pane_id="`tmux display -p"#D"`" --width=`tmux
 display -p "#{client_width}"` -R width_adjust=`tmux show-options -g status-left-length | cut -d" " -f 2`)#(/home/pj/.tmux/plugins/tmux-cpu/scripts/cpu_bg_color.sh) CPU:#(/home/pj/.tmux/plug
ins/tmux-cpu/scripts/cpu_percentage.sh) #(/home/pj/.tmux/plugins/tmux-battery/scripts/battery_status_bg.sh) #(/home/pj/.tmux/plugins/tmux-battery/scripts/battery_icon.sh)#(/home/pj/.tmux/plu
gins/tmux-battery/scripts/battery_percentage.sh)"
status-right-length 150
status-right-style default
status-style fg=yellow,bg=black
update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
visual-activity on
visual-bell off
visual-silence off
word-separators " -_@"

tmux show-window-options -g:

tmux show-window-options -g
aggressive-resize on
allow-rename on
alternate-screen on
automatic-rename off
automatic-rename-format "#{?pane_in_mode,[tmux],#{pane_current_command}}#{?pane_dead,[dead],}"
clock-mode-colour green
clock-mode-style 24
force-height 0
force-width 0
main-pane-height 24
main-pane-width 80
mode-keys vi
mode-style fg=black,bg=yellow
monitor-activity on
monitor-silence 0
other-pane-height 0
other-pane-width 0
pane-active-border-style fg=brightgreen
pane-base-index 1
pane-border-format "#{?pane_active,#[reverse],}#{pane_index}#[default] "#{pane_title}""
pane-border-status off
pane-border-style fg=black
remain-on-exit on
synchronize-panes off
window-active-style default
window-style default
window-status-activity-style fg=colour11,bg=colour233
window-status-bell-style fg=black,bg=red
window-status-current-format "#[fg=colour233,bg=colour31,nobold,noitalics,nounderscore] #[fg=colour117,bg=colour31,nobold,noitalics,nounderscore]#I#F  #[fg=colour231,bg=colour31,bold,noitalics,nounderscore]#W #[fg=colour31,bg=colour233,nobold,noitalics,nounderscore] "
window-status-current-style fg=brightred
window-status-format "#[fg=colour244,bg=colour233,nobold,noitalics,nounderscore]  #I#F #[fg=colour240,bg=colour233,nobold,noitalics,nounderscore] #[default]#W   "
window-status-last-style fg=colour31,bg=colour233
window-status-separator " "
window-status-style fg=brightblue
wrap-search on
xterm-keys on
uname -a
Linux debian 4.9.0-5-amd64 #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04) x86_64 GNU/Linux
gnome-shell --version
GNOME Shell 3.22.3
gnome-terminal --version
GNOME Terminal 3.22.2 Using VTE version 0.46.1 +GNUTLS
zsh --version
zsh 5.3.1 (x86_64-debian-linux-gnu)

Within tmux: echo $TERM screen-256color (it's set in .tmux.conf) Outside tmux in zsh: xterm-256color

Sorry about this. It's more than I'd wish to paste...

I assume it's some kind of TERM issue that gets lost within Oh-My-Zsh configuration. But the thing is this "%" only apears when I load tmuxp session.

Any ideas?

pjrulez avatar Mar 13 '18 19:03 pjrulez

I didn't mention this one at #364 to avoid confusion, but that issue explains where this behavior started to happen and why, if you downgrade to tmuxp 1.3.2/libtmux 0.7.4 I'm almost sure it will vanish for you too.

oblitum avatar Mar 14 '18 06:03 oblitum

Yeah, I tried. Uninstalled, installed with pip3 install tmuxp==1.3.2 It came with libtmux version 0.8.0. Tested loading that same session. Issue still appeared. So I tried to downgrade libtmux to 0.7.4 which I couldn't do via pip3 so I played around in tmux only to find out error appears even in sessions that were not loaded from tmuxp. So when I realized that which I didn't notice before installing tmuxp I removed tmuxp with pip3 uninstall tmuxp and new sessions don't seem to have this issue anymore.

It's definitely got something to do with tmuxp from my current observation. If I figure out otherwise I'll close this issue myself.

Actually I did some further testing and figured out the issue appears with tmuxp installed. Then I detached the session with the issue reapearing for every command, uninstalled tmux and reattached only to find the issue not appearing anymore.

Could you give me a hint, I think it must have something to do with starting those panes, $TERM. maybe I have some configuration in .bashrc or .zshrc that tmuxp invokes differently than it's invoked otherwise? Idk.

pjrulez avatar Mar 14 '18 14:03 pjrulez

Did you revert to libtmux 0.7.4? As I've commented on that issue you need to do so, problems started due to libtmux 0.7.5.

oblitum avatar Mar 14 '18 16:03 oblitum

You need to revert both to the versions I mention.

oblitum avatar Mar 14 '18 16:03 oblitum

@oblitum I need help maintaining libtmux and tmuxp. I have too much on my plate at the moment. If you could spread the word we're looking for help in #290, it'd be a big help.

As for the libtmux version, did we have it determined what piece of code did was the culprit?

tony avatar Mar 15 '18 01:03 tony

@tony determined the culprit for the new problems, no. You commented that you would try to reproduce it on more similar environment, but it stopped there, hence I've opened a new one. Determined for the old problems, issue #309, I explain on #364 what was the actual culprit that did fix it, but before that fix was merged, new stuff got merged as attempt fix and that new stuff is what's causing these new issues, I just dunno what exactly in this new code is the culprit. Solution for #309 was supposed to be simple, problem was due to this alone, but in the end too many things got in besides focusing on fixing that.

oblitum avatar Mar 15 '18 18:03 oblitum

Reminder that recently the package was moved from AUR to community on Arch, but sadly it's quite broken on Arch, AFAIK, due to #364 and #365.

oblitum avatar Mar 15 '18 19:03 oblitum

Sorry for delay. Okay so I did as you asked: screenshot The image shows why I thought I can't install the version you suggested. However I did install tmuxp 1.3.2/libtmux 0.7.4 and the problem was sadly not resolved. The % kept on showing up. Sometimes it happens sometimes it doesn't I can't pin down the exact reason why. But it doesn't happen without tmuxp. I'm a pretty new Linux user tho... If anyone finds out what could be the reason I will try it and verify.

pjrulez avatar Mar 15 '18 19:03 pjrulez

Hmm, OK. So maybe this is harder to correlate than I thought. I don't get the issue on 1.3.2/0.7.4, on latest I get this % issue: panes are created with a first char of %, following by lots of whitespace, and then the prompt, all panes show up like this. If it's happening for you even on 1.3.2/0.7.4, then I dunno.

oblitum avatar Mar 15 '18 19:03 oblitum

Okay so I'm using tmp addons tmux-continuum with resurrect and I kept the session I loaded using tmuxp before I removed it. I restarted my device and tested it a bit more and I found out it appeared again in some panes after I removed both libtmux and tmuxp and restored the session. After playing around a bit it didn't occur again, also it didn't occur with many windows and panes in a new session created using only tmux with tmuxp and libtmux removed. So I don't know but it's possible it's a direct result of something tmuxp sets up when loading a new session and which persists in the settings after tmuxp is removed. Strange.

pjrulez avatar Mar 15 '18 20:03 pjrulez

I used tmux-continuum before and it presented issues regarding scrolling, I don't use it anymore. I think if you're gonna test this issue you should avoid this plugin because it keeps running in a loop and may cause conflicts.

oblitum avatar Mar 15 '18 20:03 oblitum

Related to https://github.com/tmux-python/tmuxp/issues/364#issuecomment-377793884. Can we get a PR/testcase where this % output glitch is recreated?

tony avatar Apr 01 '18 15:04 tony

I'm getting the same issue with Kubuntu 18.04, tmux 2.6, and tmuxp 1.4.0.

session_name: project
windows:
  - window_name: Git
    layout: even-horizontal
    panes:
    - shell_command:
      - tmux rename-session ${PWD##*/}; clear
      - git status
    - shell_command:
      - git log
  - window_name: Edit
    panes:
    - shell_command:
      - vim -c "NERDTreeToggle"

The two git panes in the first window have the highlighted % sign and a few blank lines, then the command prompt. Note that the git log command opens to a pager and I don't know if tmuxp without this bug would normally leave it in that pager, but in this case it is not in a pager, but has the %, blank lines, and new prompt, as described.

The pane in the second window is in my vim session, as desired. Closing or suspending vim in that pane does not show a % or blank lines in the terminal "behind" it. Everything looks good here.

UPDATE: It seems that the git log pane is working fine, keeping me in the pager without any extra space or characters. The git status pane still has the highlighted "%" and a few lines of whitespace. I think the whole thing is caused by terminal resizing as it jumps to fill the terminal window.

My terminal line is a powerline with stuff on the left and right of the terminal window, and I know this can make resizing weird sometimes because the stuff on the right side doesn't reflow well when the terminal window is resized. So perhaps it's related? I've been meaning to simplify my powerline anyway, so if I fix it, I'll try to remember to post back here.

matthew-nm avatar Aug 18 '18 19:08 matthew-nm

Any updates on this?

paulofelisbino avatar May 06 '20 17:05 paulofelisbino

@paulofelisbino

I'm looking for help on the project in general, sorry about that! Not ignoring this (or any thread for that matter!) Apologies for any inconvenience!

I'm personally not experiencing this in my tmuxp workflow, so can't attest to this.

In case there is any activity on this issue: It would be really helpful to give a brief summation of the issue / where it stands and a PR with a test.

tony avatar May 06 '20 17:05 tony

@tony i'm willing to help, planning to learn python for a while now

paulofelisbino avatar May 06 '20 17:05 paulofelisbino

@paulofelisbino If you want to, yep.

I have no criterion for onboarding into the org itself. I don't want to make the bar so high interested people leave, on the other hand I don't want 100 org members (well, it does work for jazzband)

One way: if you review PRs (ask for em to rebase against master) and need to merge a PR, I can grant you org access, since it'd be a need then. You can @tony me in a PR to notify me. How does that sound?

tony avatar May 06 '20 22:05 tony

Confirm % and new lines in:

  • tmuxp 1.5.5
  • tmux 3.0a
  • ubuntu 18.04 inside WSL2 in windows
session_name: xxx
windows:
- window_name: vim
  panes:
  - shell_command: nvim
- window_name: commands
  layout: main-vertical
  panes:
  - clear
  - clear && php -v
  - clear && node -v

image

eduardoarandah avatar Aug 25 '20 15:08 eduardoarandah

I can also confirm % and the new lines for blank panes.

  • Arch Linux (kernel 5.7.9-arch1-1)
  • tmuxp 1.5.6
  • tmux 3.1b
  • zsh with ohmyzsh (avit prompt)

Since I have quite some experience with Python and I'm also experiencing the issue, I try to reproduce it and find the relevant parts in the code.

How would I proceed once I made myself familiar with the code or if I have questions?

pylbrecht avatar Oct 17 '20 13:10 pylbrecht

@pylbrecht Feel free to add in a PR for this issue or pass along the relevant code that you find. If you have any questions, feel free to @ me.

joseph-flinn avatar Nov 10 '20 06:11 joseph-flinn

I suspect this to be an issue of slow shell startup due to ohmyzsh. I can reproduce this "% and newlines" behavior by opening a terminal and start typing right away before the shell prompt appears.

pylbrecht avatar Jan 08 '21 23:01 pylbrecht

I can confirm thought of @pylbrecht, had the same issue.

Use sleep_before, giving your shell some time to start.

Note: requires cmd: my-command syntax (see docs)

session_name: xxx
windows:
- window_name: vim
  panes:
  - shell_command: 
    - nvim
- window_name: commands
  layout: main-vertical
  panes:
  - cmd: clear
    sleep_before: .5
  - clear && php -v
  - clear && node -v

d2dugas avatar Jun 18 '22 12:06 d2dugas