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

Disable arrow keys for selecting suggestions #129

Closed
tadashi-aikawa opened this issue May 12, 2022 · 25 comments
Closed

Disable arrow keys for selecting suggestions #129

tadashi-aikawa opened this issue May 12, 2022 · 25 comments
Assignees
Labels
enhancement New feature or request

Comments

@tadashi-aikawa
Copy link
Owner

@aubreyz

b) A bigger problem is the hijacking of the arrow keys. These are often used in editing, creating some disconcerting editing issues. One suggestion is that in the option "Additional cycle through suggestions keys" if one of these is selected then the usual arrow suggestion cycling is switched off. Or how about prefixing the suggestion with a number 1. 2. 3. etc -- then a suggestion can be chosen with Tab 1, Tab 2, Tab 3....

I see. What I can do is add a new option named "Disable arrow keys for selecting suggestions". What do you think?

Originally posted by @tadashi-aikawa in #124 (comment)

@Glint-Eye
Copy link

Yes. it would be very good to be able to disable arrow up/down keys especially if you work with lists a lot and jump around between items.

Also it would be great if "Right / Left Arrow" could be an option for cycling through suggestions as it is still very quick but not that disrupting. Usually I navigate inbetween words with ctrl + left / right anyways, so there isnt a conflict that often.

@tadashi-aikawa
Copy link
Owner Author

@aubreyz
Added in v7.0.0-beta8 🚀

@aubreyz
Copy link

aubreyz commented Jun 4, 2022

You are doing great work.
On this one the arrows are disabled, but I think that it is not only a case of disabling them -- if the up or down arrow key is pressed it should exit the suggestion list and pass the arrow key to the main editor. That way it would be seamless.

@tadashi-aikawa
Copy link
Owner Author

Thanks for your confirming, @aubreyz :)

if the up or down arrow key is pressed it should exit the suggestion list and pass the arrow key to the main editor

I implemented as you said, and confirmed it 🤔

@aubreyz
Copy link

aubreyz commented Jun 4, 2022

Indeed. I think the overall emphasis (for seamless operation) should be that if the user presses any special navigation key other than the ones specifically marked for use to navigate the list or to select a word for completion, the list should close and the key should be passed to the editor.

I think that is not just for the arrow case here but for everything

So if I type freq(downarrow), -- with arrows turned off -- a list should pop up and then disappear, but the overall effect should be as if the plugin was not installed.

If exactly the same way if I currently type freq(forwardarrow) it works well

freq(Home) works well
freq(end) does not work **
freq(pageup) works well
freq(enter) works (presuming enter is not a selection key)
freq(tab) works (if tab is not a selection key) although the list remains open (may be a good thing?)

So my point is that it should be consistent - and at the moment it is except for up-down-arrows and end (of the ones I tested)

I am distressed by your sad face..... it should be a happy hero face

@tadashi-aikawa
Copy link
Owner Author

@aubreyz
I'm sorry in words less than 😅

In my environment, it works as you said (If I didn't misunderstand)

fre(ArrowDown) then fre(ArrowUp)

2022-06-04

Is the above behavior not what you want? Or doesn't it work like the above in your environment?

@aubreyz
Copy link

aubreyz commented Jun 4, 2022

@aubreyz I'm sorry in words less than 😅

In my environment, it works as you said (If I didn't misunderstand)

fre(ArrowDown) then fre(ArrowUp)

2022-06-04 2022-06-04

Is the above behavior not what you want? Or doesn't it work like the above in your environment?

No my environment does not do that.
So it is a difference in behaviour (maybe combination of settings) not any misunderstanding.

Your video shows exactly how it should be. When I press the up and down arrow what happens is just nothing -- i.e as if no key was pressed and the list remains open.

Here is the first part of my data file:

{
  "strategy": "english-only",
  "matchStrategy": "prefix",
  "maxNumberOfSuggestions": 6,
  "maxNumberOfWordsAsPhrase": 3,
  "minNumberOfCharactersTriggered": 2,
  "minNumberOfWordsTriggeredPhrase": 1,
  "complementAutomatically": true,
  "delayMilliSeconds": 430,
  "disableSuggestionsDuringImeOn": false,
  "insertAfterCompletion": true,
  "firstCharactersDisableSuggestions": ":/^",
  "showMatchStrategy": true,
  "showComplementAutomatically": true,
  "showIndexingStatus": false,
  "descriptionOnSuggestion": "Short",
  "selectSuggestionKeys": "Shift+Space",
  "additionalCycleThroughSuggestionsKeys": "None",
  "disableUpDownKeysForCycleThroughSuggestionsKeys": true,
  "openSourceFileKey": "None",
  "propagateEsc": false,
  "enableCurrentFileComplement": false,
  "currentFileMinNumberOfCharacters": 0,
  "onlyComplementEnglishOnCurrentFileComplement": false,
  "enableCurrentVaultComplement": false,
  "currentVaultMinNumberOfCharacters": 0,
  "includeCurrentVaultPathPrefixPatterns": "",
  "excludeCurrentVaultPathPrefixPatterns": "",
  "includeCurrentVaultOnlyFilesUnderCurrentDirectory": false,
  "enableCustomDictionaryComplement": true,
  "customDictionaryPaths": "10 Utilities\\completions\\mydict.md\n10 Utilities\\completions\\mywords.md",
  "columnDelimiter": "Pipe",
  "customDictionaryWordRegexPattern": "",
  "delimiterToHideSuggestion": ";;;",
  "delimiterToDivideSuggestionsForDisplayFromInsertion": ">>>",
  "caretLocationSymbolAfterComplement": "<CARET>",
  "displayedTextSuffix": " => ...",
  "enableInternalLinkComplement": true,
  "suggestInternalLinkWithAlias": false,
  "excludeInternalLinkPathPrefixPatterns": "",
  "enableFrontMatterComplement": true,
  "frontMatterComplementMatchStrategy": "inherit",
  "insertCommaAfterFrontMatterCompletion": true,
  "showLogAboutPerformanceInConsole": false,
  "selectionHistoryTree": {

@tadashi-aikawa
Copy link
Owner Author

@aubreyz
Thank you for sharing your settings, but it doesn't seem to be any problems.

What is your OS? (Windows / Mac / Android / iPhone / iPad...)

@aubreyz
Copy link

aubreyz commented Jun 4, 2022

What is your OS? (Windows / Mac / Android / iPhone / iPad...)

Windows 10

@aubreyz
Copy link

aubreyz commented Jun 4, 2022

fol(right)
fol(left)
fol(up or down) -- this one does nothing and only way to exit is to click outside of the suggestion list

arrows

@tadashi-aikawa
Copy link
Owner Author

Umm... I use Windows 10, too.

Could you tell me your settings by this command?

I want to adapt your settings directly to my environment.

@aubreyz
Copy link

aubreyz commented Jun 4, 2022

{
"version": "6.1.0",
"mobile": false,
"settings": {
"strategy": "english-only",
"matchStrategy": "prefix",
"maxNumberOfSuggestions": 6,
"maxNumberOfWordsAsPhrase": 3,
"minNumberOfCharactersTriggered": 2,
"minNumberOfWordsTriggeredPhrase": 1,
"complementAutomatically": true,
"delayMilliSeconds": 430,
"disableSuggestionsDuringImeOn": false,
"insertAfterCompletion": true,
"firstCharactersDisableSuggestions": ":/^",
"showMatchStrategy": true,
"showComplementAutomatically": true,
"showIndexingStatus": false,
"descriptionOnSuggestion": "Short",
"selectSuggestionKeys": "Shift+Space",
"additionalCycleThroughSuggestionsKeys": "None",
"disableUpDownKeysForCycleThroughSuggestionsKeys": true,
"openSourceFileKey": "None",
"propagateEsc": false,
"enableCurrentFileComplement": false,
"currentFileMinNumberOfCharacters": 0,
"onlyComplementEnglishOnCurrentFileComplement": false,
"enableCurrentVaultComplement": false,
"currentVaultMinNumberOfCharacters": 0,
"includeCurrentVaultPathPrefixPatterns": "",
"excludeCurrentVaultPathPrefixPatterns": "",
"includeCurrentVaultOnlyFilesUnderCurrentDirectory": false,
"enableCustomDictionaryComplement": true,
"customDictionaryPaths": "10 Utilities\completions\mydict.md\n10 Utilities\completions\mywords.md",
"columnDelimiter": "Pipe",
"customDictionaryWordRegexPattern": "",
"delimiterToHideSuggestion": ";;;",
"delimiterToDivideSuggestionsForDisplayFromInsertion": ">>>",
"caretLocationSymbolAfterComplement": "",
"displayedTextSuffix": " => ...",
"enableInternalLinkComplement": true,
"suggestInternalLinkWithAlias": false,
"excludeInternalLinkPathPrefixPatterns": "",
"enableFrontMatterComplement": true,
"frontMatterComplementMatchStrategy": "inherit",
"insertCommaAfterFrontMatterCompletion": true,
"showLogAboutPerformanceInConsole": false,
"selectionHistoryTree": null
}
}

Let me know what happens. Depending on that I could try in a fresh vault with no other plugins.

@aubreyz
Copy link

aubreyz commented Jun 4, 2022

I ruled out a few things -- the problem is not altered by
a) Use of the up down arrows on the keyboard versus the numpad (both act the same)
b) Choice of suggestion key
c) Choice of alternative up down keys in the list

@tadashi-aikawa
Copy link
Owner Author

tadashi-aikawa commented Jun 4, 2022

I confirmed with a new vault and your settings but couldn't reproduce it.

1 Open .obsidian\plugins\various-complements\data.json
2. Replace "settings": ... with your settings and remove customDictionaryPaths: ...
3. Restart Obsidian

Are there any errors on the devtools console in the Obsidian?

@aubreyz
Copy link

aubreyz commented Jun 4, 2022

I created a new vault
I added the Complements plugin
I closed the vault and copied all the files from the current beta and my existing data.json to replace the installed plugin
I copied my custom dictionary across
Reopened Obsidian (is version 0.14.6)

Unfortunately the difficulty remains.....

I then deleted the data.json and restarted obsidian, and then changed only two default settings
a) Custom Dictionary on (which gets your default online one)
b) Disable the up/down arrows for selection

Unfortunately still your video is not replicated......

So am not sure
a) Is it at all possible that you are using a Beta even later than the 7.0.0-beta8 on Github?
b) Some sort of difference in the keyboard drivers for different countries that makes it detect arrow keys from your code differently???

@tadashi-aikawa
Copy link
Owner Author

tadashi-aikawa commented Jun 4, 2022

a) Is it at all possible that you are using a Beta even later than the 7.0.0-beta8 on Github?

If you installed via BRAT, The version is 7.0.0-beta8. The below is my settings (new vault).

{
    "version": "7.0.0-beta8",
    "mobile": false,
    "settings": {
        ....
    }
}

Could you confirm the version in your settings by this command?

b) Some sort of difference in the keyboard drivers for different countries that makes it detect arrow keys from your code

I confirm the keycode of ArrowUp/ArrowDown from https://www.toptal.com/developers/keycode.

image

Could you tell me the result?

@aubreyz
Copy link

aubreyz commented Jun 4, 2022

Ahh.. The way I installed the beta is to simply overwrite all of the existing

styles.css
manifest.json
manifest-beta.json
main.js

From the beta, while keeping the dat file.

All the new beta features appeared on the menu, but the version is still reported as 6.1.0 on the dump

However the manifest.json in the beta for version 7 downloaded here
https://github.com/tadashi-aikawa/obsidian-various-complements-plugin/releases/tag/7.0.0-beta8
Says 6.1.0 in the code

The manifest-beta.json
says "version": "7.0.0-beta8",

But obviously the code in main.json main.js has just one version.

If I replace the manifest.json with manifest-beta.json the version is reported differently but nothing else changes

@aubreyz
Copy link

aubreyz commented Jun 4, 2022

The downarrow key is reported as 40 with the same other settings as yours

@aubreyz
Copy link

aubreyz commented Jun 4, 2022

Apart from knowing how to get into the devtools (Control Shift I), I have no experience to know where I would look for errors within that.

@tadashi-aikawa
Copy link
Owner Author

You can see error logs as follows.

image

@tadashi-aikawa
Copy link
Owner Author

tadashi-aikawa commented Jun 5, 2022

I could reproduce it in the following case.

dev
va

2022-06-05

@tadashi-aikawa
Copy link
Owner Author

@aubreyz
Released v7.0.0-beta9 🚀

I'm not confident, but please try it.

@aubreyz
Copy link

aubreyz commented Jun 5, 2022

The beta9 solves it!!!!
So something between the beta8 and the beta9

@tadashi-aikawa
Copy link
Owner Author

Greaaaaaat!! Thanks a lot 😄

@tadashi-aikawa
Copy link
Owner Author

Released in v7.0.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

3 participants