oh-my-bash icon indicating copy to clipboard operation
oh-my-bash copied to clipboard

Using a custom powerline theme breaks command line when pasting text and moving the cursor

Open moshpirit opened this issue 1 year ago • 2 comments

I have a custom theme based on Powerline (link to the theme files on my nextcloud account). When I paste anything on the terminal, it breaks the command. In this case, let's say I want to play a youtube link with mpv, if I type mpv <url> and move the cursor back (with any terminal), I get this: imagen It seems like the characters 'ht are duplicated, but it actually displaced the three first characters to the right; in reality there's something more like this: imagen What am I missing and how can I fix it?

moshpirit avatar Dec 09 '24 18:12 moshpirit

This typically happens when the character width schemes that your shell (Bash/Readline) and terminal assume mismatch.

akinomyoga avatar Jan 27 '25 03:01 akinomyoga

So one needs to adjust the character width scheme of either the shell or the terminal.

If your terminal allows specifying the character widths of glyphs from Nerd Fonts, you should configure it. Or you may request the developer of the terminal to support the character widths of glyphs from Nerd Fonts.

If it's not possible, another possibility would be to define your own locale modifier such as @terminal_wcwidth with proper character width definitions and to specify a custom locale e.g. LANG=en_US.UTF-8@terminal_wcwidth so that Bash/Readline calculates the character widths based on this custom locale. However, this would require expertise in system locale definitions.

akinomyoga avatar Jan 27 '25 03:01 akinomyoga