tth05/obsidian-completr

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

lebigot opened this issue · 3 comments

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).

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.

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:

  • The arrows would indeed better be available for moving in the text (not in the single-item menu).
  • The single-item menu is still useful, and Enter should indeed select the suggested word.
tth05 commented

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.