acejump / AceJump

🅰️ single character search, select, and jump
https://plugins.jetbrains.com/plugin/7086-acejump
GNU General Public License v3.0
1.21k stars 91 forks source link

Option to disable the Keep Typing feature #444

Closed gary-ruizhang closed 1 year ago

gary-ruizhang commented 1 year ago

Is there an option to disable the keep typing feature and limit to just two chars? Because of the keep typing feature, the selection tag candidate will exclude all the third sequential char. This will sometimes exhaust the one char tag and use a two char tag instead.

breandan commented 1 year ago

Hi Gary, thank you for using AceJump and the nice suggestion. There are two reasons why two-character tags are needed. One is that there are more search results than the number of allowed tag characters, e.g., ~36(=[a-z0-9]) by default. One way to reduce the number of search results and encourage single-character tags is to disable the "search whole file" option (under Settings | AceJump | Behavior), which should only paint tags to locations which are visible in the editor.

Screenshot 2023-08-09 at 12 57 37 PM

As you mentioned, the second reason why two-character tags are necessary is that all subsequent characters from all matching words in all results are blocked (see Solver.canTagBeginWithChar(Editor, Int, Char) for the precise behavior). Although by design, in rare cases this behavior can cause all available tags to be blocked, see #355 for further discussion. While there is a solution to prevent this, it is probably not worth the trouble to implement since such scenarios are so rare.

The most reasonable behavior here would be to have a separate AceJump mode that only matches single-characters on screen, while minimizing the number of two-character tags assigned. When there are fewer than ~36 results, single-character tags could be assigned to all results. When there are between (36, 36^2] results, it should still be possible to assign single-character tags to at least some results by prioritizing single-character tags according to some likeliehood criteria, while ensuring all results are tagged. There is a feature request (#378) for single-character tags by default, which I think addresses your use case?