summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-06-09 17:39:16 -0400
committerGitHub <noreply@github.com>2017-06-09 17:39:16 -0400
commitaf37a3414e232c268f9b57761670c051ab3fda32 (patch)
treec2bf0ae9fad1b4d111ffbc0a0c982caf75731c84
parenteb3d29538e3f898cb69e1f2964a7f84a3c0391d4 (diff)
parentc9854771a2f280a23cb9176f820efabb69c49398 (diff)
downloadcmd2-git-af37a3414e232c268f9b57761670c051ab3fda32.tar.gz
Merge pull request #119 from python-cmd2/readline_delims
Manually set readline delimiters to not include a dash ("-")
-rwxr-xr-xcmd2.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd2.py b/cmd2.py
index 13169a17..7965ea3b 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1090,7 +1090,10 @@ class Cmd(cmd.Cmd):
if self.use_rawinput and self.completekey:
try:
self.old_completer = readline.get_completer()
+ self.old_delims = readline.get_completer_delims()
readline.set_completer(self.complete)
+ # Don't treat "-" as a readline delimiter since it is commonly used in filesystem paths
+ readline.set_completer_delims(self.old_delims.replace('-', ''))
readline.parse_and_bind(self.completekey + ": complete")
except NameError:
pass
@@ -1109,6 +1112,7 @@ class Cmd(cmd.Cmd):
if self.use_rawinput and self.completekey:
try:
readline.set_completer(self.old_completer)
+ readline.set_completer_delims(self.old_delims)
except NameError:
pass
return stop