commit
779912d517
6 changed files with 19 additions and 19 deletions
|
|
@ -101,12 +101,12 @@ var Autocomplete = function() {
|
||||||
this.changeTimer.cancel();
|
this.changeTimer.cancel();
|
||||||
|
|
||||||
if (this.popup && this.popup.isOpen) {
|
if (this.popup && this.popup.isOpen) {
|
||||||
this.gatherCompletionsId = this.gatherCompletionsId + 1;
|
this.gatherCompletionsId += 1;
|
||||||
|
this.popup.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.popup)
|
if (this.base)
|
||||||
this.popup.hide();
|
this.base.detach();
|
||||||
|
|
||||||
this.activated = false;
|
this.activated = false;
|
||||||
this.completions = this.base = null;
|
this.completions = this.base = null;
|
||||||
};
|
};
|
||||||
|
|
@ -205,8 +205,7 @@ var Autocomplete = function() {
|
||||||
var line = session.getLine(pos.row);
|
var line = session.getLine(pos.row);
|
||||||
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
|
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
|
||||||
|
|
||||||
this.base = editor.getCursorPosition();
|
this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
|
||||||
this.base.column -= prefix.length;
|
|
||||||
|
|
||||||
var matches = [];
|
var matches = [];
|
||||||
var total = editor.completers.length;
|
var total = editor.completers.length;
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ var AcePopup = function(parentNode) {
|
||||||
popup.renderer.setStyle("ace_autocomplete");
|
popup.renderer.setStyle("ace_autocomplete");
|
||||||
|
|
||||||
popup.setOption("displayIndentGuides", false);
|
popup.setOption("displayIndentGuides", false);
|
||||||
|
popup.setOption("dragDelay", 150);
|
||||||
|
|
||||||
var noop = function(){};
|
var noop = function(){};
|
||||||
|
|
||||||
|
|
@ -178,7 +179,7 @@ var AcePopup = function(parentNode) {
|
||||||
if (typeof data == "string")
|
if (typeof data == "string")
|
||||||
data = {value: data};
|
data = {value: data};
|
||||||
if (!data.caption)
|
if (!data.caption)
|
||||||
data.caption = data.value;
|
data.caption = data.value || data.name;
|
||||||
|
|
||||||
var last = -1;
|
var last = -1;
|
||||||
var flag, c;
|
var flag, c;
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ define(function(require, exports, module) {
|
||||||
var wordList = Object.keys(wordScore);
|
var wordList = Object.keys(wordScore);
|
||||||
callback(null, wordList.map(function(word) {
|
callback(null, wordList.map(function(word) {
|
||||||
return {
|
return {
|
||||||
name: word,
|
caption: word,
|
||||||
value: word,
|
value: word,
|
||||||
score: wordScore[word],
|
score: wordScore[word],
|
||||||
meta: "local"
|
meta: "local"
|
||||||
|
|
|
||||||
|
|
@ -161,10 +161,6 @@ var doLiveAutocomplete = function(e) {
|
||||||
editor.completer.autoSelect = false;
|
editor.completer.autoSelect = false;
|
||||||
editor.completer.autoInsert = false;
|
editor.completer.autoInsert = false;
|
||||||
editor.completer.showPopup(editor);
|
editor.completer.showPopup(editor);
|
||||||
} else if (!prefix && hasCompleter) {
|
|
||||||
// When the prefix is empty
|
|
||||||
// close the autocomplete dialog
|
|
||||||
editor.completer.detach();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -428,13 +428,17 @@ var TextInput = function(parentNode, host) {
|
||||||
|
|
||||||
this.onContextMenu = function(e) {
|
this.onContextMenu = function(e) {
|
||||||
afterContextMenu = true;
|
afterContextMenu = true;
|
||||||
if (!tempStyle)
|
|
||||||
tempStyle = text.style.cssText;
|
|
||||||
|
|
||||||
text.style.cssText = "z-index:100000;" + (useragent.isIE ? "opacity:0.1;" : "");
|
|
||||||
|
|
||||||
resetSelection(host.selection.isEmpty());
|
resetSelection(host.selection.isEmpty());
|
||||||
host._emit("nativecontextmenu", {target: host, domEvent: e});
|
host._emit("nativecontextmenu", {target: host, domEvent: e});
|
||||||
|
this.moveToMouse(e, true);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.moveToMouse = function(e, bringToFront) {
|
||||||
|
if (!tempStyle)
|
||||||
|
tempStyle = text.style.cssText;
|
||||||
|
text.style.cssText = (bringToFront ? "z-index:100000;" : "")
|
||||||
|
+ (useragent.isIE ? "opacity:0.1;" : "");
|
||||||
|
|
||||||
var rect = host.container.getBoundingClientRect();
|
var rect = host.container.getBoundingClientRect();
|
||||||
var style = dom.computedStyle(host.container);
|
var style = dom.computedStyle(host.container);
|
||||||
var top = rect.top + (parseInt(style.borderTopWidth) || 0);
|
var top = rect.top + (parseInt(style.borderTopWidth) || 0);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ var MouseHandler = function(editor) {
|
||||||
|
|
||||||
var focusEditor = function(e) {
|
var focusEditor = function(e) {
|
||||||
if (!editor.isFocused() && editor.textInput)
|
if (!editor.isFocused() && editor.textInput)
|
||||||
editor.textInput.onContextMenu(e);
|
editor.textInput.moveToMouse(e);
|
||||||
editor.focus()
|
editor.focus()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue