Merge remote-tracking branch 'krobelus/autocomplete-overrules-completers'
This commit is contained in:
commit
9acd4e62dc
|
@ -461,11 +461,11 @@ void InsertCompleter::select(int index, bool relative, Vector<Key>& keystrokes)
|
|||
|
||||
void InsertCompleter::update(bool allow_implicit)
|
||||
{
|
||||
m_enabled = allow_implicit or m_explicit_completer;
|
||||
if (m_explicit_completer and try_complete(m_explicit_completer))
|
||||
return;
|
||||
|
||||
reset();
|
||||
if (allow_implicit)
|
||||
setup_ifn();
|
||||
}
|
||||
|
||||
|
@ -500,6 +500,8 @@ void InsertCompleter::reset()
|
|||
|
||||
bool InsertCompleter::setup_ifn()
|
||||
{
|
||||
if (!m_enabled)
|
||||
return false;
|
||||
using namespace std::placeholders;
|
||||
if (not m_completions.is_valid())
|
||||
{
|
||||
|
|
|
@ -107,6 +107,7 @@ private:
|
|||
InsertCompletion m_completions;
|
||||
Vector<BufferRange> m_inserted_ranges;
|
||||
int m_current_candidate = -1;
|
||||
bool m_enabled = true;
|
||||
|
||||
using CompleteFunc = InsertCompletion (const SelectionList& sels,
|
||||
const OptionManager& options,
|
||||
|
|
3
test/regression/0-autocomplete-overrules-completers/in
Normal file
3
test/regression/0-autocomplete-overrules-completers/in
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
|
||||
|
3
test/regression/0-autocomplete-overrules-completers/out
Normal file
3
test/regression/0-autocomplete-overrules-completers/out
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
a2
|
||||
./ui-in
|
6
test/regression/0-autocomplete-overrules-completers/rc
Normal file
6
test/regression/0-autocomplete-overrules-completers/rc
Normal file
|
@ -0,0 +1,6 @@
|
|||
set-option global autocomplete prompt
|
||||
declare-option -hidden completions line1_completions
|
||||
declare-option -hidden completions line2_completions
|
||||
set-option global completers option=line1_completions option=line2_completions
|
||||
set-option global line1_completions "1.1+0@%val(timestamp)" "a1||a1"
|
||||
set-option global line2_completions "2.1+0@%val(timestamp)" "a2||a2"
|
10
test/regression/0-autocomplete-overrules-completers/script
Normal file
10
test/regression/0-autocomplete-overrules-completers/script
Normal file
|
@ -0,0 +1,10 @@
|
|||
ui_out -ignore 4
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "i" ] }'
|
||||
sleep .2 # trigger insert completion auto update
|
||||
# Implicit completion is disabled via autocomplete.
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "<c-n><esc>" ] }'
|
||||
# Implicit completion can be toggled.
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "ji<c-o><c-n><esc>" ] }'
|
||||
# Explicit completion still works.
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "ji./ui-<c-x>f<c-n>" ] }'
|
||||
|
Loading…
Reference in New Issue
Block a user