Morantron / tmux-fingers

copy pasting in terminal with vimium/vimperator like hints.
MIT License
1k stars 46 forks source link

Fail to match SRI string with some regexp expression #118

Closed Avimitin closed 6 months ago

Avimitin commented 6 months ago

Hi, I found some problem that I can't fix on my own. I am trying to add new regexp pattern for matching the SRI hash string:

set -g @fingers-key Space
set -g @fingers-pattern-0 '(sha256|sha384|sha512)-[A-Za-z0-9\+/]+={0,2}( +[!-~]*)?'
run-shell ~/.local/share/tmux/plugins/tmux-fingers/tmux-fingers.tmux

But with the above config I found that I still can't copy the whole SRI string:

image * grep -P is OK

image * tmux-fingers can not match the whole string

Another weird thing is that whatever I add the above config or not, the match is still the same:

image * tmux-fingers matches after config is clear

I suspect that when tmux-fingers found regexp match for a piece of text by default pattern, it won't match the text using user specified pattern again.

Avimitin commented 6 months ago

I think this might related to these implementations:

Maybe we should put user defined patterns at the front of the list.

Avimitin commented 6 months ago

Verified that after #119 this issue get fixed.

image

Avimitin commented 6 months ago

Also, SRI hash matching is really useful for web development and nix development, can I add it into default patterns?

Morantron commented 6 months ago

Also, SRI hash matching is really useful for web development and nix development, can I add it into default patterns?

Yep go ahead! You can add some tests in spec/lib/patterns_spec.cr and run tests with crystal spec spec/lib/patterns_spec.cr in the process.