Fix: skip auto magic completion when pasting
This can some times cause confusing behavior. A paste is any text insertion of more than one character at a time …
This commit is contained in:
parent
2bf673c41d
commit
07c99e0541
1 changed files with 14 additions and 0 deletions
|
|
@ -120,6 +120,20 @@ var onChangeAutocomplete = function(e, editor) {
|
|||
var pos = editor.getCursorPosition();
|
||||
var line = session.getLine(pos.row);
|
||||
|
||||
// Detect paste (poor man's paste detection)
|
||||
var pasting = (
|
||||
(
|
||||
e.data.action === 'insertText' &&
|
||||
e.data.text.length > 1
|
||||
) ||
|
||||
e.data.action === 'insertLines'
|
||||
);
|
||||
|
||||
// we don't want to autocomplete on paste events
|
||||
if(pasting) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Append added text to the line
|
||||
if(e.data.action === 'insertText') {
|
||||
line += e.data.text;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue