This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: cmd.Cmd tab completion treats dashes as spaces
Type: behavior Stage: resolved
Components: Versions: Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Jon.McKenzie
Priority: normal Keywords:

Created on 2011-02-20 00:37 by Jon.McKenzie, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
completion.snip Jon.McKenzie, 2011-02-20 00:37 Python Code Snippet
Messages (2)
msg128888 - (view) Author: Jon McKenzie (Jon.McKenzie) Date: 2011-02-20 00:37
I'm writing a cmd.Cmd module that operates on filenames. As such, I'm attempting to write tab completions that operate similar to bash. However, files that contain dashes (hyphens) appear to exhibit unexpected behavior.

It appears that somewhere along the line, dashes are converted into spaces for the purposes of tab completion.

So, for example..

(Cmd) edit blah-<tab><tab>

Should print..

blah-1.0.0.txt  blah-2.0.0.txt

And..

(Cmd) edit blah-1<tab><tab>

Should autocomplete to..

(Cmd) edit blah-1.0.0.txt

Instead, the following behavior occurs:

(Cmd) edit blah-<tab><tab>

..becomes...

(Cmd) edit blah-blah

..and thus..

(Cmd) edit blah-blah-<tab><tab>

..becomes, in turn..

(Cmd) edit blah-blah-blah

My completion function is absolutely standard, as far as I'm able to tell from looking at other examples (see attached)
msg128992 - (view) Author: Jon McKenzie (Jon.McKenzie) Date: 2011-02-21 20:52
Marked as closed, since I found this was not a bug, but just a readline default.

Can set tab completion delimiters with readline.set_completer_delims(string)
History
Date User Action Args
2022-04-11 14:57:13adminsetgithub: 55460
2011-02-21 22:40:57r.david.murraysetresolution: wont fix -> not a bug
stage: resolved
2011-02-21 20:52:37Jon.McKenziesetstatus: open -> closed

messages: + msg128992
resolution: wont fix
2011-02-20 00:37:04Jon.McKenziecreate