diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-18 13:49:03 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-18 13:49:03 -0400 |
commit | 6ac3d49383b37830c8fb7ce5fc83ac6d088a492c (patch) | |
tree | 86654c1a45f44f70eabc247199cd1c0fe84c20dc | |
parent | cafdc1cf64eccb12fba24b75c4df5cfd23f515e2 (diff) | |
download | cmd2-git-6ac3d49383b37830c8fb7ce5fc83ac6d088a492c.tar.gz |
Trying to change readline variable
-rwxr-xr-x | cmd2.py | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -429,7 +429,6 @@ def path_complete(text, line, begidx, endidx, dir_exe_only=False, dir_only=False # Readline on Linux/Mac will add a closing quote if the completed token had no slashes # If that isn't the case, then we will add a closing quote and a space to the file - delims = readline.get_completer_delims() if unclosed_quote and (os.path.sep in token_being_completed or sys.platform.startswith('win')): completions[0] += unclosed_quote + ' ' @@ -1427,6 +1426,16 @@ class Cmd(cmd.Cmd): if state == 0: import readline + + import ctypes + from ctypes.util import find_library + libname = find_library("readline") + readline_lib = ctypes.CDLL(libname) + suppress_quote = ctypes.c_int.in_dll(readline_lib, "rl_completion_suppress_quote") + suppress_quote.value = 1 + suppress_append = ctypes.c_int.in_dll(readline_lib, "rl_completion_suppress_append") + suppress_append.value = 1 + origline = readline.get_line_buffer() line = origline.lstrip() stripped = len(origline) - len(line) |