Restricted tab-completion is annoying

Aaron C. de Bruyn ubuntu-devel-discuss at darkpixel.com
Tue Oct 16 21:47:01 UTC 2007


> > I too find the programmable completion very annoying.
> 
> And I find them very useful, except where they have bugs (e.g. "sudo
> -e", which should work like 'sudoedit').  IMHO tab-completion should
> complete to what's supposed to be there in most cases, maybe even giving
> hints if there is a choice between several types of "data" (e.g. options
> vs. filenames; where the former start with "-" or "--").
> 
> OTOH, I think applications should ideally provide their own
> tab-completion, to make sure the same commandline-parser is used for
> both completion and interpretation.

I don't think the debate should be about how useful it is or how annoying it is.

If I have a file called myfile.jpg how does *LINUX* know what the file is?

You might think it's a picture because of the .jpg extension--but firefox will tell you based off the MIME TYPE.

So will the file command.

I'm not saying we need to integrate mime typing into tab completion--because it would probably slow things to a crawl, but since we can't do it the RIGHT way, we need another approach.

Here's what I see--correct me if I'm wrong, or add to it:
* Tab completion based off a file name or part of a file name is wrong.  You don't know if myfile.jpg is really a jpg or a pdf or a text file.  Take my original firefox example where myfile.asp was really a PDF.  And just last night I tried to get mplayer to play a WMV file (windows media) and it wouldn't auto-complete.  Although it played just fine.

* Because restricted tab-completion is broken, we need to find a solution

* A better way would be mime-type completion--but it would probably slow tab-completion to a crawl when you had more than a few files.  (A quick non-scientific test in a src directory shows 17 files all less than 100K took 1.017 seconds)

* Tracker seems pretty cool, but I know nothing about it.  Can we query it for a file's mime type and make it fast?

* Disable it or enable it by default but have an option to disable/enable it system wide and/or per-user.

And just to be clear, I'm not talking about disabiling the ability to do something like "svn chec<TAB>" to get "svn checkout" or tab-completion of ssh hostnames.  I am specifically talking about limiting the list of files presented based on the application you are trying to start and the file extensions.

What Ian said a few messages up the thread hits the nail on the head for me: "Predictability is far far more important than functionality for completion to be an effective useability aid."

I think the best way to solve this is by using the last option above.  Either enable or disable it by default, but provide options to enable/disable it on a per-user or per-system basis.  It's not my right to tell someone they can't run their system using broken tab-completion if they want it that way.

-A





More information about the Ubuntu-devel-discuss mailing list