diff --git a/doc_src/cmds/bind.rst b/doc_src/cmds/bind.rst index 3b321f1e3..88e081ab0 100644 --- a/doc_src/cmds/bind.rst +++ b/doc_src/cmds/bind.rst @@ -174,7 +174,7 @@ The following special input functions are available: - ``self-insert-notfirst``, inserts the matching sequence into the command line, unless the cursor is at the beginning -- ``suppress-autosuggestion``, remove the current autosuggestion +- ``suppress-autosuggestion``, remove the current autosuggestion. Returns true if there was a suggestion to remove. - ``swap-selection-start-stop``, go to the other end of the highlighted text without changing the selection diff --git a/src/reader.cpp b/src/reader.cpp index d6c7d9b9c..63d27d426 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -3298,7 +3298,10 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat } case rl::suppress_autosuggestion: { suppress_autosuggestion = true; + bool success = !autosuggestion.empty(); autosuggestion.clear(); + // Return true if we had a suggestion to clear. + inputter.function_set_status(success); break; } case rl::accept_autosuggestion: {