summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-03-15 13:14:16 -0400
committerGitHub <noreply@github.com>2018-03-15 13:14:16 -0400
commitc357f9b04b96ca31d26003e7e71e4f95a95a02e3 (patch)
tree8dbd1cc93dd270a99396131c014f0674bfc50e1d
parent543d2ae40f14f3cfd556cb482da70b26dc689f59 (diff)
parent87b0a61b1e668d5b18d93b3ec7a528a645edd2a1 (diff)
downloadcmd2-git-c357f9b04b96ca31d26003e7e71e4f95a95a02e3.tar.gz
Merge pull request #311 from python-cmd2/fix/useless-history-line-in-select
remove history line in select when user insert choice
-rwxr-xr-xcmd2.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/cmd2.py b/cmd2.py
index ea892bcb..5181f1c4 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -2046,6 +2046,9 @@ class Cmd(cmd.Cmd):
self.poutput(' %2d. %s\n' % (idx + 1, text))
while True:
response = sm.input(prompt)
+ hlen = readline.get_current_history_length()
+ if hlen >= 1 and response != '':
+ readline.remove_history_item(hlen - 1)
try:
response = int(response)
result = fulloptions[response - 1][0]