Disable 'interactive' options in :exec/:eval
Incremental search, automatic info and completion are not needed in non interactive context.
This commit is contained in:
parent
f08966197e
commit
fe70add4b7
|
@ -955,6 +955,22 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func)
|
|||
GlobalHooks::instance().enable_hooks();
|
||||
});
|
||||
|
||||
struct DisableOption {
|
||||
DisableOption(Context& context, const char* name)
|
||||
: m_option(context.options()[name]),
|
||||
m_prev_value(m_option.get<bool>())
|
||||
{ m_option.set(false); }
|
||||
|
||||
~DisableOption() { m_option.set(m_prev_value); }
|
||||
|
||||
Option& m_option;
|
||||
bool m_prev_value;
|
||||
};
|
||||
DisableOption disable_autoinfo(context, "autoinfo");
|
||||
DisableOption disable_autoshowcompl(context, "autoshowcompl");
|
||||
DisableOption disable_incsearch(context, "incsearch");
|
||||
|
||||
|
||||
ClientManager& cm = ClientManager::instance();
|
||||
if (parser.has_option("buffer"))
|
||||
{
|
||||
|
|
|
@ -56,7 +56,7 @@ Option& OptionManager::get_local_option(const String& name)
|
|||
|
||||
}
|
||||
|
||||
const Option& OptionManager::operator[](const String& name) const
|
||||
Option& OptionManager::operator[](const String& name)
|
||||
{
|
||||
auto it = find_option(m_options, name);
|
||||
if (it != m_options.end())
|
||||
|
@ -67,6 +67,11 @@ const Option& OptionManager::operator[](const String& name) const
|
|||
throw option_not_found(name);
|
||||
}
|
||||
|
||||
const Option& OptionManager::operator[](const String& name) const
|
||||
{
|
||||
return const_cast<OptionManager&>(*this)[name];
|
||||
}
|
||||
|
||||
template<typename MatchingFunc>
|
||||
CandidateList OptionManager::get_matching_names(MatchingFunc func)
|
||||
{
|
||||
|
|
|
@ -88,6 +88,7 @@ public:
|
|||
OptionManager(OptionManager& parent);
|
||||
~OptionManager();
|
||||
|
||||
Option& operator[] (const String& name);
|
||||
const Option& operator[] (const String& name) const;
|
||||
Option& get_local_option(const String& name);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user