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

Prefer 1-key tags #471

Open
arialdomartini opened this issue Nov 21, 2024 · 2 comments
Open

Prefer 1-key tags #471

arialdomartini opened this issue Nov 21, 2024 · 2 comments
Labels

Comments

@arialdomartini
Copy link

In many cases, when there are fewer candidates then available allowed characters in tags, AceJump could offer all 1-key tags.

Yet, for some reason, it suggests many 2-key tags.

Here a case.
I defined the following characters as available allowed characters in tags:

fjdksla;rueiwoqpvmc,x.z/

They are 23.

With this setup, here's what I see activating "All lines marks mode"

image

Notice that, the candidates are 19, so technically there is no need to use 2-char tags, because there are enough available allowed characters in tags to have all 1-char tags.

@arialdomartini
Copy link
Author

Reading past issues, I find this one could be a duplicate of #378

@breandan
Copy link
Collaborator

Yes, #378 is related - thanks for reporting. It looks like it should be possible to assign all one-letter tags in the scenario you described. There are two places to consider:

val availableTags = allPossibleTags.filter { !queryText.endsWith(it[0]) && it !in tagMap }

The second place is here:

private fun canTagBeginWithChar(editor: Editor, site: Int, char: Char): Boolean {

We might be able to add a special case to detect when (1) the number of sites to tag is fewer than the number of allowed characters and when (2) all the allowed characters can be assigned to sites without introducing a tag collision, to fall back to single-character tags.

It might also be tricky, because even though there exists a matching requiring fewer than n single character tags in total does not mean it will be easy to find because the tag constraints could require some backtracking to utilize all the tags. In the worst case, it could require trying all sites x allowed characters matchings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants