Skip to content

feat: add autocompletion of paths to the "go to" dialog#88

Open
agriggio wants to merge 1 commit intonetdcy:mainfrom
agriggio:goto-autocomplete
Open

feat: add autocompletion of paths to the "go to" dialog#88
agriggio wants to merge 1 commit intonetdcy:mainfrom
agriggio:goto-autocomplete

Conversation

@agriggio
Copy link
Contributor

Proof of concept implementation for #87

var currentSuggestionIndex: Int = -1
var initSuggestions: Bool = true

override func keyUp(with event: NSEvent) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it might be because the keydown event for the tab key is processed first for switching focus, so you chose to use the keyup event? But this results in two behaviors at the same time. Therefore, it is better to add interception for the tab key in the code section that defines application shortcuts (eventMonitorKeyDown) and invoke the relevant autocompletion function based on the context.

var initSuggestions: Bool = true

override func keyUp(with event: NSEvent) {
if event.keyCode == 48 /* Tab */
Copy link
Owner

@netdcy netdcy May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to use semantic values instead of keycodes, like in the application shortcut key section(eventMonitorKeyDown). #16

} else if event.keyCode == 126 /* Arrow up */ {
doAutocomplete(reverse: true)
} else {
initSuggestions = true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the left and right keys are used to move the cursor, the initSuggestions variable is reset, causing the behavior of pressing the up and down keys to change, which may not be very reasonable. Perhaps the theoretically best solution would be to decide which level of directory should be switched based on the cursor's position?

@agriggio
Copy link
Contributor Author

Hi,
thanks for the feedback! I pretty much agree with all your observations, that's why I explicitly marked this as "proof of concept". Unfortunately my knowledge of Swift is almost non-existent, so I'm not sure how long it will take me to improve, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants