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

upcase-command doesn't work for user regexp #81

Closed
nkh opened this issue Mar 14, 2021 · 10 comments
Closed

upcase-command doesn't work for user regexp #81

nkh opened this issue Mar 14, 2021 · 10 comments

Comments

@nkh
Copy link

nkh commented Mar 14, 2021

when this regexp is added
set -g @thumbs-regexp-1 '-?-[a-zA-Z0-9_]+' # options
running thumbs highlights the matches and the default matches, ie SHAs.

uppercase command works for the SHAs but not for the user defined regexp
weirdly the dash '-' also matches tilde '~'

@fcsonline
Copy link
Owner

fcsonline commented Mar 15, 2021

Can you share some example of text you are trying to match?

It is weird the behaviour you are mentioning because the matching and the uppercase are two pieces of code that are not related.

@nkh
Copy link
Author

nkh commented Mar 16, 2021

hi,
here's my setup, last line adds a custom regexp
when I enter selection mode the options are highlighted but uppercase selction does not insert them in the command line, if other selections, ie sha1, are present they work; I have just tested again just to make sure I'm not delusional (for this at least).

I had a quick look at the code and wasn't able to see anything (I have zero Rust knowledge but I can read code).

once this is fixed, a {regexp} variable that tells which one has matched would be useful in the thumb-command option

set -g @plugin 'fcsonline/tmux-thumbs' # prefix + space
set -g @thumbs-command 'tmux set-buffer {} && echo -n {} | copy'
set -g @thumbs-upcase-command 'tmux set-buffer {} && tmux paste-buffer'
set -g @thumbs-reverse 1
set -g @thumbs-unique 1
set -g @thumbs-regexp-1 '-?-[a-zA-Z0-9_]+' # options

@nkh
Copy link
Author

nkh commented Mar 16, 2021

Example text:

478 ~/2/large L:■ 46f 260+ 303- 157u gl

  • e835497 x (HEAD -> master) (25 hours ago, Nadim Khemir)
  • 1e58173 x (25 hours ago, Nadim Khemir)
  • 6d6ed25 x (25 hours ago, Nadim Khemir)
  • d0fe934 x (25 hours ago, Nadim Khemir)
  • f4843a8 check with git (2 days ago, Nadim Khemir)
    478 ~/2/large L:■ 46f 260+ 303- 157u pbs depend
    --check_dependencies_at_build_time --display_dependencies_long --display_dependency_time --display_parallel_depend_no_resource
    --dependency_result --display_dependencies_regex --display_depend_end --display_parallel_depend_start
    --depend_full_log --display_dependencies_regex_not --display_depend_indented --log_parallel_depend
    --depend_full_log_options --display_dependencies_rule_name --display_depend_new_line --node_dependencies
    --depend_header --display_dependencies_rule_name_not --display_depend_remaining_processes --no_has_no_dependencies
    --depend_jobs --display_dependency_full_pbsfile --display_depend_separator --no_warning_matching_with_zero_dependencies
    --depend_log --display_dependency_insertion_rule --display_full_dependency_path --short_dependency_path_string
    --depend_log_merged --display_dependency_matching_rule --display_no_dependencies_ok --tree_depended_at
    --depend_processes --display_dependency_regex --display_parallel_depend_end --tree_display_no_dependencies
    --display_dependencies --display_dependency_rule_definition --display_parallel_depend_node --use_depend_server
    478 ~/2/large L:■ 46f 260+ 303- 157u

@fcsonline
Copy link
Owner

Ok, thanks for share it. But exactly which is the text you want to pick? It is just to test the regexp.

@nkh
Copy link
Author

nkh commented Mar 16, 2021

well, one of the options (and maybe more), IE: --depend_log

@fcsonline
Copy link
Owner

fcsonline commented Mar 16, 2021

Ok, I was able to reproduce it. There are two things to take into consideration to make it work. Thanks to your report, I discovered a small mistake in the README documentation.

The Regexp is incorrect. It should be like this:

set -g @thumbs-regexp-1 '\-\-[a-zA-Z0-9_]+' # options

On the other hand, the command configuration needs an extra -- in front of the interpolation, because the picked text was interpreted as set-buffer argument 😅 :

set -g @thumbs-command 'tmux set-buffer -- {} && tmux display-message \"Copied {}\"'
set -g @thumbs-upcase-command 'tmux set-buffer -- {} && tmux paste-buffer && tmux display-message \"Copied {}\"'

I updated the documentation to avoid this kind of issues here: 3a06364

Let me know if it works.

@nkh
Copy link
Author

nkh commented Mar 16, 2021

I works; regexp is fine I want to get single dash options too.

While I have your attention, I reported two other bugs one that would be real cool to have, no removing text color, and one that's making the plugin much less useful, selecting i a zoomed panel. I hope you get a chance to look at it.

Thanks for telling me how to fix this one

@fcsonline
Copy link
Owner

Selecting in a zoomed panel is something that was fixed weeks ago. Check if you have the latest code and recompile again, plz.

About the color, this is a hard one. No plans to solve it in the short term

@nkh
Copy link
Author

nkh commented Mar 17, 2021

selecting in zoom panel works now, I closed the issue

What's so hard with keeping the color?

@fcsonline
Copy link
Owner

Ok, then I can close this issue. About the color one you can track it here: #65

If you want to give it a try and find a solution, I'll really appreciate it.

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