Using a custom powerline theme breaks command line when pasting text and moving the cursor
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:
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:
What am I missing and how can I fix it?
This typically happens when the character width schemes that your shell (Bash/Readline) and terminal assume mismatch.
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.