songz
songz

Reputation: 2092

Duplicate characters when opening typescript files in vim inside a tmux session

My code editor bug

Context

I am using my work server (ubuntu 16.04) as my coding environment. Whenever I open up a typescript file (.ts), I get a strange rendering issue that makes it hard for me to code. Looking at the picture above, there is (incorrectly) two c and a character a from the variable name is missing.

What could be the issue?

Expected code - const storeData = ...

Current display - cconst storeDat = ...

My setup

When I open the files in the terminal (not in a tmux session), it renders nicely

enter image description here

What I tried

Upvotes: 0

Views: 195

Answers (1)

songz
songz

Reputation: 2092

Upon looking at the differences between the 2 images, I suspected it may be because of unsupported utf-8 issue. So I came across this question which suggested setting environment variables:

export LC_ALL=en_IN.UTF-8
export LANG=en_IN.UTF-8

And it turns out I did not have the UTF-8 language pack, so I was getting this issue:

warning: Setting locale failed.

To fix that, I installed the language pack as suggested in the answer:

sudo apt-get install language-pack-en

Now the main issue is fixed! I no longer see the bad display as posted in the original question.


BEWARE - Before forcing tmux into utf-8, make sure you backup your tmux sessions. In doing these steps, I lost all my existing tmux sessions and I could not connect to them. I got the error below:

open terminal failed: can't find terminfo database

To fix the issue I had to stop the tmux server and then recreate the previously existing sessions.

tmux kill-server

Upvotes: 1

Related Questions