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:
Aaron O'Mullan 2014-01-28 00:52:55 +01:00
commit 07c99e0541

View file

@ -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;