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 <darkstarsw...@gmail.com>
---
 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 f65f1d5..d2f8fb3 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 fbb4d7f..e62fe2b 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 7c714e4..5b9e7d9 100644
--- a/reader.cpp
+++ b/reader.cpp
@@ -3258,7 +3258,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:
-- 
1.7.10

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to