Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctrl-r fails on encoding related problem #51

Closed
harelba opened this issue Jun 6, 2014 · 4 comments
Closed

ctrl-r fails on encoding related problem #51

harelba opened this issue Jun 6, 2014 · 4 comments

Comments

@harelba
Copy link

harelba commented Jun 6, 2014

Playing around with command lines which have non ascii characters. At some point Ctrl-r started throwing the following.

I would have sent you my history output, but there's too much sensitive data there...

Here's part of the command line which is related to the issue. However, I was playing with it for several hours before it started to cause issues, so I'm not sure that this is the origin of the issue.

select Hráč Protihráč, sum(Zabití) Zabití, sum(Smrtí) Smrtí

This is the exception:

/home/harel/.fzf/fzf:486:in `=~': incompatible encoding regexp match (UTF-8 regexp with IBM852 string) (Encoding::CompatibilityError)
    from /home/harel/.fzf/fzf:486:in `trim'
    from /home/harel/.fzf/fzf:405:in `format'
    from /home/harel/.fzf/fzf:715:in `block (2 levels) in update_list'
    from /home/harel/.fzf/fzf:709:in `each'
    from /home/harel/.fzf/fzf:709:in `each_with_index'
    from /home/harel/.fzf/fzf:709:in `block in update_list'
    from /home/harel/.fzf/fzf:727:in `call'
    from /home/harel/.fzf/fzf:727:in `block in start_renderer'
@junegunn
Copy link
Owner

junegunn commented Jun 6, 2014

Hi, thanks for the report. Looking the the call stack, it seems that you're not running the latest revision. Could you update and check if it still fails? I can't reproduce the problem with the following command:

echo "select Hráč Protihráč, sum(Zabití) Zabití, sum(Smrtí) Smrtí" | fzf

And which version of Ruby are your running?

@harelba
Copy link
Author

harelba commented Jun 6, 2014

Installed newest version, still happens. like i sai, the example above did not immediately break Ctrl-r, it's just the only non-ascii data i've actually wrote in the terminal.

/home/harel/.fzf/fzf:446:in `=~': invalid byte sequence in UTF-8 (ArgumentError)"s/ *[0-9]* *//")
    from /home/harel/.fzf/fzf:446:in `trim'
    from /home/harel/.fzf/fzf:380:in `format'
    from /home/harel/.fzf/fzf:681:in `block (2 levels) in update_list'
    from /home/harel/.fzf/fzf:675:in `each'
    from /home/harel/.fzf/fzf:675:in `each_with_index'
    from /home/harel/.fzf/fzf:675:in `block in update_list'
    from /home/harel/.fzf/fzf:695:in `call'
    from /home/harel/.fzf/fzf:695:in `block in start_renderer'

ruby version:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

@junegunn
Copy link
Owner

junegunn commented Jun 6, 2014

Thanks for the info. The exception was thrown inside trim method which is only called when the length of an item is wider than the screen width. And the failing regex match was made to determine the width of a character. I've just updated the code to ignore the error and simply assume that the width is 1. So it's not the ultimate fix to the underlying problem, but I think it's harmless.

Could you update and test again? Should work fine.

@junegunn
Copy link
Owner

I believe this has been fixed. Please reopen if you see this problem again. Thanks.

junegunn pushed a commit that referenced this issue Jan 16, 2024
Bump github.com/rivo/uniseg to v0.2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants