GNOME Bugzilla – Bug 314873
Auto-completion should work when the cursor is in the middle of a path
Last modified: 2008-04-08 00:37:50 UTC
I often run into the following use case: 1. I select a "save as" operation in an application 2. The save as dialog appears with a highlighted filename that I want to use 3. I want to type a directory path for the filname so I press Control-A to get to the beginning of the Name field, and unhighlight the name. 4. I start typing a portion of the path 5. I press TAB to get auto-completion At this point, the result of TAB is that the cursor is moved to the end of the text in the entry, and no completion occurs. What I would like instead is for completion to be performed based on the text preceeding the cursor and the result should be inserted at the cursor. This would leave the cursor in the correct location for continued typing and completion while I find the desired directory. The text after the cursor should never be affected. The behavior I want appears to be implemented quite nicely already in bash, so it would be an appropriate model to use if any questions come up as to how some details of this should work. Other information:
*** Bug 350273 has been marked as a duplicate of this bug. ***
*** Bug 367427 has been marked as a duplicate of this bug. ***
Created attachment 106659 [details] [review] gtk2-bgo314873-filechooser-tab-in-the-middle-of-entry.diff This is a patch in progress. It is a gradual rewrite of the completion engine in the file chooser's entry. What works now: - Autocompletion and Tab completion. - Tab completion when the cursor is not at the end of the entry. - Nice feedback with tooltips about what completion is doing (a la Emacs). - Performance improvements for completion in general. Missing things: - More predictable behavior of the popup suggestion list (it works; it's just the same as before). - Making the suggestion list scroll if you hit Tab subsequent times.
Created attachment 107194 [details] [review] gtk2-bgo314873-filechooser-completion-rewrite.diff This is the git patchset that I committed to SVN trunk. 2008-03-12 Federico Mena Quintero <federico@novell.com> Rework the way completion works in GtkFileChooserEntry. Fixes http://bugzilla.gnome.org/attachment.cgi?bugid=314873 - Tab completion should work even if the cursor is not at the end of the entry. * gtk/gtkfilechooserentry.c: Change the strategy by which we do completion. We distinguish between two cases: - autocompletion - happens only in the Open modes by inserting and selecting the common prefix as you type. - explicit completion - happens when you hit Tab. When some type of completion needs to happen, the entry first parses its input and sees if it needs to initiate a folder load. Completion will not happen until the folder finishes loading. If the folder is already completely loaded, then completion is performed immediately. Otherwise, the entry queues a pending completion and starts loading the new folder (or waits until the current folder is completely loaded). Tab completion is allowed to happen even if the cursor is not at the end of the entry. There is a new feedback mechanism for explicit completion, so that you will get an Emacs-like tip whenever there are ambiguities in completion, no matches, etc. (This needs to be polished so that we support RTL entries and all the fancy Pango layout in GtkEntry). The only remaining thing to fix is the popup suggestion window. Unfortunately, GtkEntryCompletion does not let us do what we want, and will need further changes.
*** Bug 406821 has been marked as a duplicate of this bug. ***