After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 314873 - Auto-completion should work when the cursor is in the middle of a path
Auto-completion should work when the cursor is in the middle of a path
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.8.x
Other All
: High minor
: Small fix
Assigned To: Federico Mena Quintero
Federico Mena Quintero
: 350273 367427 406821 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-08-30 19:52 UTC by Carl Worth
Modified: 2008-04-08 00:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtk2-bgo314873-filechooser-tab-in-the-middle-of-entry.diff (46.81 KB, patch)
2008-03-06 03:43 UTC, Federico Mena Quintero
needs-work Details | Review
gtk2-bgo314873-filechooser-completion-rewrite.diff (167.14 KB, patch)
2008-03-13 00:56 UTC, Federico Mena Quintero
committed Details | Review

Description Carl Worth 2005-08-30 19:52:54 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:
Comment 1 Federico Mena Quintero 2006-08-15 19:05:55 UTC
*** Bug 350273 has been marked as a duplicate of this bug. ***
Comment 2 Federico Mena Quintero 2007-11-30 18:50:23 UTC
*** Bug 367427 has been marked as a duplicate of this bug. ***
Comment 3 Federico Mena Quintero 2008-03-06 03:43:40 UTC
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.
Comment 4 Federico Mena Quintero 2008-03-13 00:56:11 UTC
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.
Comment 5 Federico Mena Quintero 2008-04-08 00:37:50 UTC
*** Bug 406821 has been marked as a duplicate of this bug. ***