From c8f86d94c9847b0c01bdd98ddcfc8296d95ea8c4 Mon Sep 17 00:00:00 2001 From: Ian Munsie Date: Wed, 27 Jun 2012 18:37:48 +1000 Subject: [PATCH] Add command to temporarily suppress the autosuggestion feature Autosuggestion will be automatically re-enabled next time a character is inserted. An alternative implementation would require another command to explicitly re-enable it. Signed-off-by: Ian Munsie --- input.cpp | 6 ++++-- input.h | 1 + reader.cpp | 8 +++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/input.cpp b/input.cpp index f65f1d5a6..d2f8fb346 100644 --- a/input.cpp +++ b/input.cpp @@ -129,7 +129,8 @@ static const wchar_t *name_arr[] = L"end-of-buffer", L"repaint", L"up-line", - L"down-line" + L"down-line", + L"suppress-autosuggestion" } ; @@ -210,7 +211,8 @@ static const wchar_t code_arr[] = R_END_OF_BUFFER, R_REPAINT, R_UP_LINE, - R_DOWN_LINE + R_DOWN_LINE, + R_SUPPRESS_AUTOSUGGESTION, } ; diff --git a/input.h b/input.h index fbb4d7fd7..e62fe2bb6 100644 --- a/input.h +++ b/input.h @@ -49,6 +49,7 @@ enum R_REPAINT, R_UP_LINE, R_DOWN_LINE, + R_SUPPRESS_AUTOSUGGESTION, } ; diff --git a/reader.cpp b/reader.cpp index db8ba2a66..8d5783115 100644 --- a/reader.cpp +++ b/reader.cpp @@ -3247,7 +3247,13 @@ const wchar_t *reader_readline() break; } - + + case R_SUPPRESS_AUTOSUGGESTION: + { + data->suppress_autosuggestion = true; + data->autosuggestion.clear(); + reader_repaint(); + } /* Other, if a normal character, we add it to the command */ default: