-
Notifications
You must be signed in to change notification settings - Fork 270
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
codenav/goto_file: Improvements & fixes (tab key autocomplete, absolute dirs, ~/) #1390
Open
gkatev
wants to merge
15
commits into
geany:master
Choose a base branch
from
gkatev:codenav_goto_file_improvements
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gkatev
force-pushed
the
codenav_goto_file_improvements
branch
from
November 27, 2024 10:11
851b0de
to
6d6b2e8
Compare
…nd file Previously, if the file wasn't found and you replied 'no' to the prompt for creating it, all dialogs closed. This can be annoying in situations where the name/path was entered wrong, and you have to start all over again after receiving the file not found error. This commit allows one to amend the mistake from right where they left off. It was deemed necessary to add GTK_DIALOG_MODAL flag to the dialog creation. Without it, after the repeat gtk_dialog_run call (through the goto), the UI got kinda bugged, with the focus (correctly) being in the dialog, but visually appearing as if it had shifted back to the editor pane.
The user's home directory is used as a relative path reference.
1. Can now use Tab key to 'accept' autocomplete's 'suggestion' 2. Add dir separator to end of items in completion list that are directories, to make traversing a path quicker, especially when used together with (1). 3. Show the completion list as soon as the goto_file dialog opens (at the same directory as the document). The code kind of reads like this is also what the original author intended.
The pre-existing funcionality of using Tab to accept a completion suggestion is still supported. Furthermore, the Enter key may also be used now to accept a suggestion.
The way the completion model to use when no directory separator is found is unecessarily convoluted. This change simplifies and improves it. Also fixes a bug that can cause junky behaviour when pasting a path as soon as the dialog opens, if that was also the last path in the dialog the last time it was opened. The root cause is that the completion model is set during init to the reference directory, but directory_check() does not create a new one for the pasted path, because curr_dir (which is static) has not been updated to reflect that the reference mode is now active.
The new directory_check is (IMHO) simpler, easier to follow and maintain, and less prone to edge cases. As part of simplifications, do away with the "reference model". We do keep track of the "reference dir" and if need be simply calculate a mode for it as if any other dir. Bonus (admittedly rare) issue solved: not having to close and reopen the dialog if a file is created while it's opened...
Move the respective g_signal_connect before gtk_entry_set_completion(), which is where the GtkEntryCompletion's handler gets installed.
…vent Does not seem our place to decide whether the default handler should not run, and it doesn't harm us any way if it does...
gkatev
force-pushed
the
codenav_goto_file_improvements
branch
from
November 27, 2024 11:33
6d6b2e8
to
09e5004
Compare
gkatev
force-pushed
the
codenav_goto_file_improvements
branch
from
November 27, 2024 12:03
09e5004
to
798c804
Compare
gkatev
added a commit
to gkatev/geany-plugins
that referenced
this pull request
Nov 27, 2024
… dirs, ~/) PR geany#1390 New features & changes: - The Tab key can now be used to: (Inspired from shells, and GtkFileChooser) - Show the completion list when it's hidden - Trigger an inline completion - Accept a suggested inline completion - Keep dialog open after user denies creation of not-found file (geany#1329) - Allow absolute paths, and recognize ~ as the user's home dir - If no document is open, the current dir is the user's home dir - Show error if the entered path is a directory - Bug fixes, improvements, code formatting fixes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, this supercharges codenav/goto_file with a wide range of changes, fixes, and new features.
I've included all the smaller commits, in case someone wants to take a closer look at each change, but I can squash them together before merging. This also supersedes #1329.
Features & changes:
(Inspired from shells, and GtkFileChooser)
~
as the user's home dirShow completion list as soon as dialog opensDemo:
codenav.mp4