mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-07-03 10:01:16 -03:00
Allow turning off autosuggestions
This adds a variable, $fish_autosuggestion_enabled. When set to 0, it will turn off autosuggestions/highlighting. Setting it to anything else will enable it (which also means this remains enabled by default).
This commit is contained in:
@@ -603,7 +603,7 @@ struct layout_data_t {
|
||||
class reader_data_t : public std::enable_shared_from_this<reader_data_t> {
|
||||
public:
|
||||
/// Configuration for the reader.
|
||||
const reader_config_t conf;
|
||||
reader_config_t conf;
|
||||
/// The parser being used.
|
||||
std::shared_ptr<parser_t> parser_ref;
|
||||
/// String containing the whole current commandline.
|
||||
@@ -2612,6 +2612,18 @@ void reader_change_history(const wcstring &name) {
|
||||
}
|
||||
}
|
||||
|
||||
void reader_set_autosuggestion_enabled(bool enable) {
|
||||
// We don't need to _change_ if we're not initialized yet.
|
||||
reader_data_t *data = current_data_or_null();
|
||||
if (data) {
|
||||
if (data->conf.autosuggest_ok != enable) {
|
||||
data->conf.autosuggest_ok = enable;
|
||||
data->force_exec_prompt_and_repaint = true;
|
||||
data->inputter.queue_char(readline_cmd_t::repaint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Add a new reader to the reader stack.
|
||||
/// \return a shared pointer to it.
|
||||
static std::shared_ptr<reader_data_t> reader_push_ret(parser_t &parser,
|
||||
|
||||
Reference in New Issue
Block a user