Enable auto magic complete only when typing
We only want to auto magically complete when the user is typing text, not when text is pasted or being removed.
This commit is contained in:
parent
afd9c99da2
commit
af1aab40f5
1 changed files with 5 additions and 7 deletions
|
|
@ -121,24 +121,22 @@ var onChangeAutocomplete = function(e, editor) {
|
|||
var line = session.getLine(pos.row);
|
||||
|
||||
// Detect paste (poor man's paste detection)
|
||||
var pasting = (
|
||||
var typing = !(
|
||||
(
|
||||
e.data.action === 'insertText' &&
|
||||
e.data.text.length > 1
|
||||
) ||
|
||||
e.data.action === 'insertLines'
|
||||
e.data.action !== 'insertText'
|
||||
);
|
||||
|
||||
// we don't want to autocomplete on paste events
|
||||
if(pasting) {
|
||||
if(!typing) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Append added text to the line
|
||||
if(e.data.action === 'insertText') {
|
||||
line += e.data.text;
|
||||
pos.column += e.data.text.length;
|
||||
}
|
||||
line += e.data.text;
|
||||
pos.column += e.data.text.length;
|
||||
|
||||
// The prefix to autocomplete for
|
||||
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue