abo-abo / avy

Jump to things in Emacs tree-style
1.73k stars 110 forks source link

de-Bruijn candidate selection may fail when `avy-single-candidate-jump` is `nil` #338

Open dan-robertson opened 2 years ago

dan-robertson commented 2 years ago

The function that assigns sequences to candidates will try to work out how many characters are needed as ceil(log(#candidates)/log(#chars)) but if #candidates = 1, it’s logarithm is 0 and the function will later fail.

One fix would be to clamp this value with a lower bound of 1.

Another may be to use a different candidate-display function if there is a single candidate.

dan-robertson commented 2 years ago

Actually, the fix described above doesn’t properly work: I get one candidate in the right place and one at the point.