Duplicated characters and non-updating input using tmux in zsh
Asked Answered
E

3

12

First off: I'm using tmux 2.5 installed via homebrew on OS X 10.12, in iTerm 2 (though the problem appears in Terminal.app as well). My tmux.conf is on Github, along with my zshrc.

The problem: Seemingly out of nowhere, I started seeing an issue with typing in the prompt. Typing keys once will display them twice, and backspacing will move the cursor forward and redraw characters already present on the line. This only happens inside of a tmux session, and not inside my "regular" terminal.

Here's a gif of the issue. In this gif, I type 1234567890, then hit backspace 9 times, and type ls. Note that 0 only shows up once, and lls with a duplicated l runs the ls command as expected.

gif of weird input behavior

Hopefully I just hit a weird key combo on accident, but I've been stuck on this for a while.

Thanks for any help!

Edwards answered 29/8, 2017 at 5:17 Comment(3)
did you try to empty your .tmux.conf and see whether this issue still occurs or not?Mccann
@minhtuannguyen thanks for the reminder to go back a ways. I narrowed it down, and also had to kill the server instead of just re-sourcing tmux.conf.Edwards
I have the same issue when changing set -g default-terminal "screen-256color" to tmux-256color. Not sure why.Sough
A
7

Installing tmux-256color for macOS as in this guide solves the problem.

Running the following as mentioned in a github issue solved the problem for me:

brew install ncurses
$(brew --prefix)/opt/ncurses/bin/infocmp tmux-256color > ~/tmux-256color.info
tic -xe tmux-256color tmux-256color.info
infocmp tmux-256color | head
Appall answered 12/10, 2022 at 13:18 Comment(1)
/opt/homebrew is the new Homebrew prefix for ARM (Apple Silicon), so: /opt/homebrew/Cellar/ncurses/6.3/bin/infocmp tmux-256color > ~/tmux-256color.info (or whatever version got installed)Stream
S
2

I'm also running into this issue as well. I encountered the problem similar to @artemave, by trying to change the set -g default-terminal "screen-256color" to set -g default-terminal "tmux-256color". The goal of doing this was to gain italics, per the tmux FAQ.

@taylor's answer didn't work for me, as I didn't have that command.

I managed to determine that:

  1. The issue doesn't occur with bash

  2. When running a blank .zshrc, backspacing creates new blank lines, but I'm not seeing the character duplication

  3. Using tmux-256color will successfully give italic fonts

  4. Using TERM=xterm-256color and TERM=konsole-256color does not change the above effects

  5. Using xfce4terminal (0.8.9.1), Konsole (19.12.3), or URXVT (9.22) doesn't change the above behavior

I wasn't able to really "fix" the issue, as the even going down to a blank .tmux.conf wasn't able to change anything. Instead, I just needed to change it to anything else. xterm-256color was suggested in this issue, but I found nearly anything else would work fine.

I'll keep working on it and update this answer if I find anything else.

Edit: This tmux issue is the exact issue we're running into. I'll see if the solutions there work

https://github.com/tmux/tmux/issues/597

Edit 2: I've submitted a GitHub issue with tmux. No real results yet, but it does offer some guidance on things to check on.

Streamy answered 27/3, 2020 at 18:23 Comment(0)
E
0

The problem seems to be fixed after commenting out this line from my tmux.conf:

set -g default-command "reattach-to-user-namespace -l zsh"

I also had to manually run tmux kill-server instead of relying on just re-sourcing my conf file.

When I find some time, I'll look more into what went wrong here...

Edwards answered 29/8, 2017 at 22:45 Comment(1)
Killing tmux was also the solution for me once I'd updated the term database.Hypotrachelium

© 2022 - 2024 — McMap. All rights reserved.