tth05 / obsidian-completr

Auto-completion plugin for the obsidian editor.
MIT License
291 stars 18 forks source link

[Feature request] No suggestion when there is a single one #55

Closed lebigot closed 1 year ago

lebigot commented 1 year ago

Where there is a single suggestion, the user is prevented from using arrow keys for moving the cursor in the text because they go through the "list" of suggestions. This is arguably not useful since there is a single suggestion.

I therefore suggest the following feature: do not display any menu when there is a single suggestion, so that the arrow keys can really be useful (for moving in the text).

lebigot commented 1 year ago

PS: Another reason to not display single suggestions is also that the Enter key is now "eaten" by the (single word) menu, which does nothing but make it disappear: the user who wants to add a new line must press Enter again. Without this "no choice" menu, the user could directly press Enter for inserting a newline.

lebigot commented 1 year ago

PPS: The situation is actually a bit more subtle: in a case where the (only) suggested word is identical to the typed word, there is obviously no need for the menu, which only slows users down.

In the case of a single suggested word which is different from the typed word:

tth05 commented 1 year ago

I therefore suggest the following feature: do not display any menu when there is a single suggestion, so that the arrow keys can really be useful (for moving in the text).

This is currently the case, because when ignoring case, the suggestion might still be different than the actual word. It definitely makes sense to disable this, if the word is a perfect match.

PS: Another reason to not display single suggestions is also that the Enter key is now "eaten" by the (single word) menu, which does nothing but make it disappear: the user who wants to add a new line must press Enter again. Without this "no choice" menu, the user could directly press Enter for inserting a newline.

I'd like to add that there are bypass commands for this (default Ctrl+Enter), which allow the same thing but with two keys.

The arrows would indeed better be available for moving in the text (not in the single-item menu).

Yeah, although when auto-focus is disabled you need them to focus the popup.