diff --git a/README.md b/README.md index dfc5af1..669ca5b 100644 --- a/README.md +++ b/README.md @@ -501,6 +501,8 @@ I was curious to know if this was possible to be written in [Rust](https://www.r ## Troubleshooting +> `tmux-thumbs` isn't as fast as expected + `tmux-thumbs` must work lighting fast. If you are facing a slow performance capturing the screen hints try to configure Tmux with these settings: ``` @@ -511,8 +513,9 @@ set -g visual-silence on You can read a bit more about this issue here: https://github.com/fcsonline/tmux-thumbs/issues/88 -Every time I use `tmux-thumbs`, dead panes are created. Just review if you have -this setting on: +> Every time I use `tmux-thumbs`, dead panes are created. + +Just review if you have this setting on: ``` set -g remain-on-exit on @@ -520,6 +523,13 @@ set -g remain-on-exit on You can read a bit more about this issue here: https://github.com/fcsonline/tmux-thumbs/issues/84 +> Sometimes I see the hints showing up in the wrong starting location. + +This is likely because the lines with the incorrectly-positioned hints have ligatures. Many CLI utilities +and prompt themes have ligatures. + +You can read a bit more about this issue here: https://github.com/fcsonline/tmux-thumbs/issues/158 https://github.com/fcsonline/tmux-thumbs/pull/161 + ## Donations If you appreciate all the job done in this project, a small donation is always welcome: diff --git a/src/state.rs b/src/state.rs index 2e3e00c..e148b33 100644 --- a/src/state.rs +++ b/src/state.rs @@ -468,4 +468,22 @@ mod tests { assert_eq!(results.get(7).unwrap().text.clone(), "8888"); assert_eq!(results.get(8).unwrap().text.clone(), "https://crates.io/23456/fd70b569"); } + + #[test] + fn hint_positioning() { + // first line contains two matched strings, second line has a prefix, third line has a ligature + let lines = split("20240913-lorem-ipsum 10240913-lorem-ipsum-0\n-20240913-lorem-ipsum-1\n↳20240913-lorem-ipsum-2"); + let custom = [].to_vec(); + let results = State::new(&lines, "abcd", &custom).matches(false, true); + + assert_eq!(results.get(0).unwrap().x.clone(), 0); + assert_eq!(results.get(0).unwrap().y.clone(), 0); + assert_eq!(results.get(1).unwrap().x.clone(), 21); + assert_eq!(results.get(1).unwrap().y.clone(), 0); + assert_eq!(results.get(2).unwrap().x.clone(), 1); + assert_eq!(results.get(2).unwrap().y.clone(), 1); + // regex matching can't be aware of ligatures + assert_eq!(results.get(3).unwrap().x.clone(), 3); + assert_eq!(results.get(3).unwrap().y.clone(), 2); + } }