commit
b557fe931d
5 changed files with 38 additions and 37 deletions
|
|
@ -146,7 +146,7 @@ var TokenTooltip = function(editor) {
|
||||||
var st = tooltipNode.style;
|
var st = tooltipNode.style;
|
||||||
if (x + 10 + this.tooltipWidth > this.maxWidth)
|
if (x + 10 + this.tooltipWidth > this.maxWidth)
|
||||||
x = innerWidth - this.tooltipWidth - 10;
|
x = innerWidth - this.tooltipWidth - 10;
|
||||||
if (y > innerHeight * 0.75 || y + 20 + this.tooltipHeight > this.maxHeight);
|
if (y > innerHeight * 0.75 || y + 20 + this.tooltipHeight > this.maxHeight)
|
||||||
y = y - this.tooltipHeight - 30;
|
y = y - this.tooltipHeight - 30;
|
||||||
|
|
||||||
st.left = x + 10 + "px";
|
st.left = x + 10 + "px";
|
||||||
|
|
|
||||||
|
|
@ -74,13 +74,13 @@ var actions = exports.actions = {
|
||||||
fn: function(editor, range, count, param) {
|
fn: function(editor, range, count, param) {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case "z":
|
case "z":
|
||||||
editor.alignCursor(null, 0.5);
|
editor.renderer.alignCursor(null, 0.5);
|
||||||
break;
|
break;
|
||||||
case "t":
|
case "t":
|
||||||
editor.alignCursor(null, 0);
|
editor.renderer.alignCursor(null, 0);
|
||||||
break;
|
break;
|
||||||
case "b":
|
case "b":
|
||||||
editor.alignCursor(null, 1);
|
editor.renderer.alignCursor(null, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,17 +80,14 @@ var Marker = function(parentEl) {
|
||||||
var top = this.$getTop(range.start.row, config);
|
var top = this.$getTop(range.start.row, config);
|
||||||
var left = this.$padding + range.start.column * config.characterWidth;
|
var left = this.$padding + range.start.column * config.characterWidth;
|
||||||
marker.renderer(html, range, left, top, config);
|
marker.renderer(html, range, left, top, config);
|
||||||
}
|
} else if (marker.type == "fullLine") {
|
||||||
if (marker.type == "fullLine") {
|
|
||||||
this.drawFullLineMarker(html, range, marker.clazz, config);
|
this.drawFullLineMarker(html, range, marker.clazz, config);
|
||||||
}
|
} else if (range.isMultiLine()) {
|
||||||
else if (range.isMultiLine()) {
|
|
||||||
if (marker.type == "text")
|
if (marker.type == "text")
|
||||||
this.drawTextMarker(html, range, marker.clazz, config);
|
this.drawTextMarker(html, range, marker.clazz, config);
|
||||||
else
|
else
|
||||||
this.drawMultiLineMarker(html, range, marker.clazz, config);
|
this.drawMultiLineMarker(html, range, marker.clazz, config);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.drawSingleLineMarker(html, range, marker.clazz + " ace_start", config);
|
this.drawSingleLineMarker(html, range, marker.clazz + " ace_start", config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,36 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* I hate doing this, but we need some way to determine if the user is on a Mac
|
||||||
|
* The reason is that users have different expectations of their key combinations.
|
||||||
|
*
|
||||||
|
* Take copy as an example, Mac people expect to use CMD or APPLE + C
|
||||||
|
* Windows folks expect to use CTRL + C
|
||||||
|
*/
|
||||||
|
exports.OS = {
|
||||||
|
LINUX: "LINUX",
|
||||||
|
MAC: "MAC",
|
||||||
|
WINDOWS: "WINDOWS"
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return an exports.OS constant
|
||||||
|
*/
|
||||||
|
exports.getOS = function() {
|
||||||
|
if (exports.isMac) {
|
||||||
|
return exports.OS.MAC;
|
||||||
|
} else if (exports.isLinux) {
|
||||||
|
return exports.OS.LINUX;
|
||||||
|
} else {
|
||||||
|
return exports.OS.WINDOWS;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// this can be called in non browser environments (e.g. from ace/requirejs/text)
|
||||||
|
if (typeof navigator != "object")
|
||||||
|
return;
|
||||||
|
|
||||||
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
|
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
|
||||||
var ua = navigator.userAgent;
|
var ua = navigator.userAgent;
|
||||||
|
|
||||||
|
|
@ -69,30 +99,4 @@ exports.isIPad = ua.indexOf("iPad") >= 0;
|
||||||
|
|
||||||
exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
|
exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
|
||||||
|
|
||||||
/*
|
|
||||||
* I hate doing this, but we need some way to determine if the user is on a Mac
|
|
||||||
* The reason is that users have different expectations of their key combinations.
|
|
||||||
*
|
|
||||||
* Take copy as an example, Mac people expect to use CMD or APPLE + C
|
|
||||||
* Windows folks expect to use CTRL + C
|
|
||||||
*/
|
|
||||||
exports.OS = {
|
|
||||||
LINUX: "LINUX",
|
|
||||||
MAC: "MAC",
|
|
||||||
WINDOWS: "WINDOWS"
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return an exports.OS constant
|
|
||||||
*/
|
|
||||||
exports.getOS = function() {
|
|
||||||
if (exports.isMac) {
|
|
||||||
return exports.OS.MAC;
|
|
||||||
} else if (exports.isLinux) {
|
|
||||||
return exports.OS.LINUX;
|
|
||||||
} else {
|
|
||||||
return exports.OS.WINDOWS;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ var CstyleBehaviour = function () {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n" || text == "\r\n") {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue