tmux-copycat icon indicating copy to clipboard operation
tmux-copycat copied to clipboard

Bug when highlighting a match in zsh shell prompt

Open bruno- opened this issue 10 years ago • 6 comments

If a user has sophisticated zsh shell prompt with unicode characters, match selection could be buggy.

Example: zsh shell prompt contains unicode chars and current directory path. File search (prefix + C-f) highlights the directory path invalidly. Presumably, this is because of unicode characters.

bruno- avatar Aug 06 '14 13:08 bruno-

This is indeed an issue and it affects me. Consider the following text:

11:12 ircuser123 │ check out my super cool link! http://example.com :D
11:13 ircuser123 │ is anybody there?

In principle, <prefix> ctrl-u should highlight http://example.com. Instead, due to the multibyte character earlier in the line, it selects the rather less useful tp://example.com :. The behaviour becomes even more destructive when the URL appears at the end of the line; the selection will include the newline character, plus characters from the next line. Very annoying, especially when used with tmux-open.

qstrahl avatar Nov 25 '15 21:11 qstrahl

@bruno- I'd like to take a stab at fixing this... can you point me toward the code responsible for finding the boundaries of the search item?

qstrahl avatar Dec 10 '15 15:12 qstrahl

Hey, the solution for this seems to be installing gawk as indicated in the readme install section.

gawk has better unicode handling so we made this a drop-in replacement for awk. Once you install it everything should work ok. If you try this please leave feedback, thx.

bruno- avatar Dec 13 '15 23:12 bruno-

Yup, that seems to take care of it. Thanks!

qstrahl avatar Dec 22 '15 16:12 qstrahl

Hi guys, it's still not completely solved, not working well with CJK characters.

朕吞玻璃不伤身体 11:12 ircuser123 │ check out my super cool link! http://example.com :D

Paste this in your tmux and try prefix + <C-u>. Here is what I got:

screen shot 2016-02-20 at 6 10 23 pm

secondwtq avatar Feb 20 '16 10:02 secondwtq

not working well with CJK characters

I tested your line and I can reproduce the issue. Not sure how to solve it though. Using gawk was the best approach till now.

bruno- avatar Feb 20 '16 14:02 bruno-