Merge branch 'master' of github.com:ajaxorg/ace
This commit is contained in:
commit
fc01cc6242
62 changed files with 632 additions and 336 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
|
@ -3,4 +3,4 @@
|
|||
url = git://github.com/ajaxorg/ace.wiki.git
|
||||
[submodule "build"]
|
||||
path = build
|
||||
url = https://github.com/ajaxorg/ace-builds.git
|
||||
url = git://github.com/ajaxorg/ace-builds.git
|
||||
|
|
|
|||
|
|
@ -153,10 +153,6 @@ function ace() {
|
|||
source: ACE_HOME + "/LICENSE",
|
||||
dest: "build/LICENSE"
|
||||
});
|
||||
copy({
|
||||
source: ACE_HOME + "/Readme.md",
|
||||
dest: "build/Readme.md"
|
||||
});
|
||||
copy({
|
||||
source: ACE_HOME + "/ChangeLog.txt",
|
||||
dest: "build/ChangeLog.txt"
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ Features
|
|||
Take Ace for a spin!
|
||||
--------------------
|
||||
|
||||
Check out the Ace live [demo](http://ajaxorg.github.com/ace-builds/kitchen-sink.html) or get a [Cloud9 IDE account](http://c9.io) to experience Ace while editing one of your own GitHub projects.
|
||||
Check out the Ace live [demo](http://ajaxorg.github.com/ace/build/kitchen-sink.html) or get a [Cloud9 IDE account](http://c9.io) to experience Ace while editing one of your own GitHub projects.
|
||||
|
||||
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.com/ace-builds/textarea/editor.html).
|
||||
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.com/ace/build/textarea/editor.html).
|
||||
|
||||
Getting the code
|
||||
----------------
|
||||
|
|
@ -123,7 +123,7 @@ The editor can then be opened at http://localhost:8888/kitchen-sink.html.
|
|||
Package Ace
|
||||
-----------
|
||||
|
||||
To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. (see the [wiki](https://github.com/ajaxorg/ace/wiki/Building-ace) more for details)
|
||||
To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. (see the [wiki](https://github.com/ajaxorg/ace/wiki/Building-ace) for more details)
|
||||
|
||||
```bash
|
||||
npm install
|
||||
|
|
|
|||
2
build
2
build
|
|
@ -1 +1 @@
|
|||
Subproject commit b5354412bfeb461b7d8020423562451a81da2c85
|
||||
Subproject commit 8f508c64856878dc43cb9d0aeb028ca34ede6f5c
|
||||
|
|
@ -169,47 +169,47 @@ function makeHuge(txt) {
|
|||
}
|
||||
|
||||
var docs = {
|
||||
"docs/c9search.c9search_results": "C9 Search Results",
|
||||
"docs/javascript.js": "JavaScript",
|
||||
"docs/plaintext.txt": {name: "Plain Text", prepare: makeHuge, wrapped: true},
|
||||
"docs/clojure.clj": "Clojure",
|
||||
"docs/coffeescript.coffee": "Coffeescript",
|
||||
"docs/json.json": "JSON",
|
||||
"docs/diff.diff": "Diff",
|
||||
"docs/css.css": "CSS",
|
||||
"docs/scss.scss": "SCSS",
|
||||
"docs/less.less": "LESS",
|
||||
"docs/html.html": "HTML",
|
||||
"docs/xml.xml": "XML",
|
||||
"docs/tcl.tcl": "Tcl",
|
||||
"docs/yaml.yaml": "YAML",
|
||||
"docs/svg.svg": "SVG",
|
||||
"docs/php.php": "PHP",
|
||||
"docs/coldfusion.cfm": "ColdFusion",
|
||||
"docs/python.py": "Python",
|
||||
"docs/ruby.rb": "Ruby",
|
||||
"docs/perl.pl": "Perl",
|
||||
"docs/ocaml.ml": "OCaml",
|
||||
"docs/OpenSCAD.scad": "OpenSCAD",
|
||||
"docs/cpp.cpp": "C/C++",
|
||||
"docs/csharp.cs": "C#",
|
||||
"docs/css.css": "CSS",
|
||||
"docs/diff.diff": "Diff",
|
||||
"docs/golang.go": "Go",
|
||||
"docs/groovy.groovy": "Groovy",
|
||||
"docs/Haxe.hx": "haXe",
|
||||
"docs/html.html": "HTML",
|
||||
"docs/java.java": "Java",
|
||||
"docs/json.json": "JSON",
|
||||
"docs/jsx.jsx": "JSX",
|
||||
"docs/latex.tex": {name: "LaTeX", wrapped: true},
|
||||
"docs/less.less": "LESS",
|
||||
"docs/liquid.liquid": "Liquid",
|
||||
"docs/lua.lua": "Lua",
|
||||
"docs/luapage.lp": "LuaPage",
|
||||
"docs/liquid.liquid": "Liquid",
|
||||
"docs/java.java": "Java",
|
||||
"docs/clojure.clj": "Clojure",
|
||||
"docs/groovy.groovy": "Groovy",
|
||||
"docs/scala.scala": "Scala",
|
||||
"docs/csharp.cs": "C#",
|
||||
"docs/powershell.ps1": "Powershell",
|
||||
"docs/cpp.cpp": "C/C++",
|
||||
"docs/Haxe.hx": "haXe",
|
||||
"docs/sh.sh": "SH",
|
||||
"docs/xquery.xq": "XQuery",
|
||||
"docs/markdown.md": {name: "Markdown", wrapped: true},
|
||||
"docs/textile.textile": {name: "Textile", wrapped: true},
|
||||
"docs/latex.tex": {name: "LaTeX", wrapped: true},
|
||||
"docs/sql.sql": {name: "SQL", wrapped: true},
|
||||
"docs/ocaml.ml": "OCaml",
|
||||
"docs/OpenSCAD.scad": "OpenSCAD",
|
||||
"docs/perl.pl": "Perl",
|
||||
"docs/pgsql.pgsql": {name: "pgSQL", wrapped: true},
|
||||
"docs/golang.go": "Go",
|
||||
"docs/jsx.jsx": "JSX"
|
||||
"docs/php.php": "PHP",
|
||||
"docs/plaintext.txt": {name: "Plain Text", prepare: makeHuge, wrapped: true},
|
||||
"docs/powershell.ps1": "Powershell",
|
||||
"docs/python.py": "Python",
|
||||
"docs/ruby.rb": "Ruby",
|
||||
"docs/scala.scala": "Scala",
|
||||
"docs/scss.scss": "SCSS",
|
||||
"docs/sh.sh": "SH",
|
||||
"docs/sql.sql": {name: "SQL", wrapped: true},
|
||||
"docs/svg.svg": "SVG",
|
||||
"docs/tcl.tcl": "Tcl",
|
||||
"docs/textile.textile": {name: "Textile", wrapped: true},
|
||||
"docs/xml.xml": "XML",
|
||||
"docs/xquery.xq": "XQuery",
|
||||
"docs/yaml.yaml": "YAML",
|
||||
"docs/c9search.c9search_results": "C9 Search Results"
|
||||
}
|
||||
|
||||
var ownSource = {
|
||||
|
|
@ -286,7 +286,7 @@ env.editor.commands.addCommands([{
|
|||
name: "gotoline",
|
||||
bindKey: {win: "Ctrl-L", mac: "Command-L"},
|
||||
exec: function(editor, line) {
|
||||
if (typeof needle == "object") {
|
||||
if (typeof line == "object") {
|
||||
var arg = this.name + " " + editor.getCursorPosition().row;
|
||||
editor.cmdLine.setValue(arg, 1)
|
||||
editor.cmdLine.focus()
|
||||
|
|
@ -328,7 +328,7 @@ cmdLine.commands.bindKeys({
|
|||
},
|
||||
})
|
||||
|
||||
cmdLine.commands.removeCommands(["find", "goToLine", "findAll", "replace", "replaceAll"])
|
||||
cmdLine.commands.removeCommands(["find", "gotoline", "findall", "replace", "replaceall"])
|
||||
|
||||
/**
|
||||
* This demonstrates how you can define commands and bind shortcuts to them.
|
||||
|
|
@ -557,6 +557,10 @@ bindCheckbox("show_hidden", function(checked) {
|
|||
env.editor.setShowInvisibles(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("display_indent_guides", function(checked) {
|
||||
env.editor.setDisplayIndentGuides(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("show_gutter", function(checked) {
|
||||
env.editor.renderer.setShowGutter(checked);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@
|
|||
|
||||
<h2>Take Ace for a spin!</h2>
|
||||
<div class="divider"></div>
|
||||
<p>Check out the <a href="http://ajaxorg.github.com/ace-builds/kitchen-sink.html">Ace live demo</a> or get a <a href="http://c9.io">Cloud9 IDE account</a> to experience Ace while editing one of your own GitHub projects.</p>
|
||||
<p>Check out the <a href="./build/kitchen-sink.html">Ace live demo</a> or get a <a href="http://c9.io">Cloud9 IDE account</a> to experience Ace while editing one of your own GitHub projects.</p>
|
||||
|
||||
<h2>History</h2>
|
||||
<div class="divider"></div>
|
||||
|
|
|
|||
|
|
@ -59,32 +59,36 @@
|
|||
<label for="theme">Theme</label>
|
||||
</td><td>
|
||||
<select id="theme" size="1">
|
||||
<option value="ace/theme/chrome">Chrome</option>
|
||||
<option value="ace/theme/clouds">Clouds</option>
|
||||
<option value="ace/theme/clouds_midnight">Clouds Midnight</option>
|
||||
<option value="ace/theme/cobalt">Cobalt</option>
|
||||
<option value="ace/theme/crimson_editor">Crimson Editor</option>
|
||||
<option value="ace/theme/dawn">Dawn</option>
|
||||
<option value="ace/theme/dreamweaver">Dreamweaver</option>
|
||||
<option value="ace/theme/eclipse">Eclipse</option>
|
||||
<option value="ace/theme/github">GitHub</option>
|
||||
<option value="ace/theme/idle_fingers">idleFingers</option>
|
||||
<option value="ace/theme/kr_theme">krTheme</option>
|
||||
<option value="ace/theme/merbivore">Merbivore</option>
|
||||
<option value="ace/theme/merbivore_soft">Merbivore Soft</option>
|
||||
<option value="ace/theme/mono_industrial">Mono Industrial</option>
|
||||
<option value="ace/theme/monokai">Monokai</option>
|
||||
<option value="ace/theme/pastel_on_dark">Pastel on dark</option>
|
||||
<option value="ace/theme/solarized_dark">Solarized Dark</option>
|
||||
<option value="ace/theme/solarized_light">Solarized Light</option>
|
||||
<option value="ace/theme/textmate" selected="selected">TextMate</option>
|
||||
<option value="ace/theme/twilight">Twilight</option>
|
||||
<option value="ace/theme/tomorrow">Tomorrow</option>
|
||||
<option value="ace/theme/tomorrow_night">Tomorrow Night</option>
|
||||
<option value="ace/theme/tomorrow_night_blue">Tomorrow Night Blue</option>
|
||||
<option value="ace/theme/tomorrow_night_bright">Tomorrow Night Bright</option>
|
||||
<option value="ace/theme/tomorrow_night_eighties">Tomorrow Night 80s</option>
|
||||
<option value="ace/theme/vibrant_ink">Vibrant Ink</option>
|
||||
<optgroup label="Bright">
|
||||
<option value="ace/theme/chrome">Chrome</option>
|
||||
<option value="ace/theme/clouds">Clouds</option>
|
||||
<option value="ace/theme/crimson_editor">Crimson Editor</option>
|
||||
<option value="ace/theme/dawn">Dawn</option>
|
||||
<option value="ace/theme/dreamweaver">Dreamweaver</option>
|
||||
<option value="ace/theme/eclipse">Eclipse</option>
|
||||
<option value="ace/theme/github">GitHub</option>
|
||||
<option value="ace/theme/solarized_light">Solarized Light</option>
|
||||
<option value="ace/theme/textmate" selected="selected">TextMate</option>
|
||||
<option value="ace/theme/tomorrow">Tomorrow</option>
|
||||
</optgroup>
|
||||
<optgroup label="Dark">
|
||||
<option value="ace/theme/clouds_midnight">Clouds Midnight</option>
|
||||
<option value="ace/theme/cobalt">Cobalt</option>
|
||||
<option value="ace/theme/idle_fingers">idleFingers</option>
|
||||
<option value="ace/theme/kr_theme">krTheme</option>
|
||||
<option value="ace/theme/merbivore">Merbivore</option>
|
||||
<option value="ace/theme/merbivore_soft">Merbivore Soft</option>
|
||||
<option value="ace/theme/mono_industrial">Mono Industrial</option>
|
||||
<option value="ace/theme/monokai">Monokai</option>
|
||||
<option value="ace/theme/pastel_on_dark">Pastel on dark</option>
|
||||
<option value="ace/theme/solarized_dark">Solarized Dark</option>
|
||||
<option value="ace/theme/twilight">Twilight</option>
|
||||
<option value="ace/theme/tomorrow_night">Tomorrow Night</option>
|
||||
<option value="ace/theme/tomorrow_night_blue">Tomorrow Night Blue</option>
|
||||
<option value="ace/theme/tomorrow_night_bright">Tomorrow Night Bright</option>
|
||||
<option value="ace/theme/tomorrow_night_eighties">Tomorrow Night 80s</option>
|
||||
<option value="ace/theme/vibrant_ink">Vibrant Ink</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -139,8 +143,8 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td colspan="2">
|
||||
<table id="more-controls">
|
||||
<tr><td colspan="2">
|
||||
<table id="more-controls">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="select_style">Full Line Selection</label>
|
||||
|
|
@ -162,6 +166,13 @@
|
|||
<input type="checkbox" name="show_hidden" id="show_hidden" checked>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td >
|
||||
<label for="display_indent_guides">Show Indent Guides</label>
|
||||
</td><td>
|
||||
<input type="checkbox" name="display_indent_guides" id="display_indent_guides" checked>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td >
|
||||
<label for="show_hscroll">Persistent HScroll</label>
|
||||
|
|
@ -218,7 +229,7 @@
|
|||
<label for="fade_fold_widgets">Fade Fold Widgets</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" id="fade_fold_widgets" checked>
|
||||
<input type="checkbox" id="fade_fold_widgets">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -117,11 +117,13 @@ exports.commands = [{
|
|||
name: "selecttostart",
|
||||
bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
|
||||
exec: function(editor) { editor.getSelection().selectFileStart(); },
|
||||
multiSelectAction: "forEach",
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "gotostart",
|
||||
bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
|
||||
exec: function(editor) { editor.navigateFileStart(); },
|
||||
multiSelectAction: "forEach",
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectup",
|
||||
|
|
|
|||
|
|
@ -27,6 +27,12 @@
|
|||
z-index: 4;
|
||||
}
|
||||
|
||||
.ace_gutter_active_line {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.ace_scroller.horscroll {
|
||||
box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2029,7 +2029,7 @@ var EditSession = function(text, mode) {
|
|||
* - row (Number): The row number to check
|
||||
*
|
||||
*
|
||||
* Returns the length of the indicated row.
|
||||
* Returns number of screenrows in a wrapped line.
|
||||
**/
|
||||
this.getRowLength = function(row) {
|
||||
if (!this.$useWrapMode || !this.$wrapData[row]) {
|
||||
|
|
@ -2039,18 +2039,6 @@ var EditSession = function(text, mode) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* EditSession.getRowHeight(config, row) -> Number
|
||||
* - config (Object): An object containing a parameter indicating the `lineHeight`.
|
||||
* - row (Number): The row number to check
|
||||
*
|
||||
* Returns the height of the indicated row. This is mostly relevant for situations where wrapping occurs, and a single line spans across multiple rows.
|
||||
*
|
||||
**/
|
||||
this.getRowHeight = function(config, row) {
|
||||
return this.getRowLength(row) * config.lineHeight;
|
||||
};
|
||||
|
||||
/** internal, hide, related to: EditSession.documentToScreenColumn
|
||||
* EditSession.getScreenLastRowColumn(screenRow) -> Number
|
||||
* - screenRow (Number): The screen row to check
|
||||
|
|
|
|||
|
|
@ -729,7 +729,7 @@ function Folding() {
|
|||
} else {
|
||||
if (addSubfolds)
|
||||
this.foldAll(row + 1, this.getLength());
|
||||
e.target.className += " invalid"
|
||||
(e.target || e.srcElement).className += " invalid"
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ var Editor = function(renderer, session) {
|
|||
this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
|
||||
session.addEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
|
||||
|
||||
this.$onChangeTabSize = this.renderer.updateText.bind(this.renderer);
|
||||
this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer);
|
||||
session.addEventListener("changeTabSize", this.$onChangeTabSize);
|
||||
|
||||
this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
|
||||
|
|
@ -694,6 +694,9 @@ var Editor = function(renderer, session) {
|
|||
* called whenever a text "paste" happens.
|
||||
**/
|
||||
this.onPaste = function(text) {
|
||||
// todo this should change when paste becomes a command
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
this._emit("paste", text);
|
||||
this.insert(text);
|
||||
};
|
||||
|
|
@ -988,9 +991,6 @@ var Editor = function(renderer, session) {
|
|||
* If `showInvisibiles` is set to `true`, invisible characters—like spaces or new lines—are show in the editor.
|
||||
**/
|
||||
this.setShowInvisibles = function(showInvisibles) {
|
||||
if (this.getShowInvisibles() == showInvisibles)
|
||||
return;
|
||||
|
||||
this.renderer.setShowInvisibles(showInvisibles);
|
||||
};
|
||||
|
||||
|
|
@ -1003,6 +1003,14 @@ var Editor = function(renderer, session) {
|
|||
return this.renderer.getShowInvisibles();
|
||||
};
|
||||
|
||||
this.setDisplayIndentGuides = function(display) {
|
||||
this.renderer.setDisplayIndentGuides(display);
|
||||
};
|
||||
|
||||
this.getDisplayIndentGuides = function() {
|
||||
return this.renderer.getDisplayIndentGuides();
|
||||
};
|
||||
|
||||
/**
|
||||
* Editor.setShowPrintMargin(showPrintMargin)
|
||||
* - showPrintMargin (Boolean): Specifies whether or not to show the print margin
|
||||
|
|
|
|||
|
|
@ -72,11 +72,10 @@ exports.render = function(input, mode, theme, lineStart, disableGutter) {
|
|||
var length = session.getLength();
|
||||
|
||||
for(var ix = 0; ix < length; ix++) {
|
||||
var lineTokens = session.getTokens(ix);
|
||||
stringBuilder.push("<div class='ace_line'>");
|
||||
if (!disableGutter)
|
||||
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
|
||||
textLayer.$renderLine(stringBuilder, 0, lineTokens, true);
|
||||
textLayer.$renderLine(stringBuilder, 0, true, false);
|
||||
stringBuilder.push("</div>");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -193,7 +193,6 @@ exports.transformTextarea = function(element, loader) {
|
|||
var settingOpener = document.createElement("div");
|
||||
applyStyles(settingOpener, {
|
||||
position: "absolute",
|
||||
width: "15px",
|
||||
right: "0px",
|
||||
bottom: "0px",
|
||||
background: "red",
|
||||
|
|
|
|||
|
|
@ -118,7 +118,9 @@ var TextInput = function(parentNode, host) {
|
|||
var onPropertyChange = function(e) {
|
||||
setTimeout(function() {
|
||||
if (!inCompostion)
|
||||
sendText();
|
||||
if(text.value != "") {
|
||||
sendText();
|
||||
}
|
||||
}, 0);
|
||||
};
|
||||
|
||||
|
|
@ -166,7 +168,24 @@ var TextInput = function(parentNode, host) {
|
|||
};
|
||||
|
||||
event.addCommandKeyListener(text, host.onCommandKey.bind(host));
|
||||
event.addListener(text, "input", useragent.isIE ? onPropertyChange : onTextInput);
|
||||
event.addListener(text, "input", onTextInput);
|
||||
|
||||
if (useragent.isOldIE) {
|
||||
var keytable = { 13:1, 27:1 };
|
||||
event.addListener(text, "keyup", function (e) {
|
||||
if (inCompostion && (!text.value || keytable[e.keyCode]))
|
||||
setTimeout(onCompositionEnd, 0);
|
||||
if ((text.value.charCodeAt(0)|0) < 129) {
|
||||
return;
|
||||
}
|
||||
inCompostion ? onCompositionUpdate() : onCompositionStart();
|
||||
});
|
||||
|
||||
event.addListener(text, "propertychange", function() {
|
||||
if (text.value != PLACEHOLDER)
|
||||
setTimeout(sendText, 0);
|
||||
});
|
||||
}
|
||||
|
||||
event.addListener(text, "paste", function(e) {
|
||||
// Mark that the next input text comes from past.
|
||||
|
|
@ -206,7 +225,7 @@ var TextInput = function(parentNode, host) {
|
|||
});
|
||||
event.addListener(text, "cut", onCut); // for ie9 context menu
|
||||
}
|
||||
else if (useragent.isOpera) {
|
||||
else if (useragent.isOpera && !("KeyboardEvent" in window)) {
|
||||
event.addListener(parentNode, "keydown", function(e) {
|
||||
if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)
|
||||
return;
|
||||
|
|
@ -268,11 +287,14 @@ var TextInput = function(parentNode, host) {
|
|||
tempStyle = text.style.cssText;
|
||||
|
||||
text.style.cssText =
|
||||
"position:fixed; z-index:100000;" + //"background:rgba(250, 0, 0, 0.3); opacity:1;" +
|
||||
"position:fixed; z-index:100000;" +
|
||||
(useragent.isIE ? "background:rgba(0, 0, 0, 0.03); opacity:0.1;" : "") + //"background:rgba(250, 0, 0, 0.3); opacity:1;" +
|
||||
"left:" + (e.clientX - 2) + "px; top:" + (e.clientY - 2) + "px;";
|
||||
|
||||
if (host.selection.isEmpty())
|
||||
text.value = "";
|
||||
else
|
||||
reset(true);
|
||||
|
||||
if (e.type != "mousedown")
|
||||
return;
|
||||
|
|
@ -281,7 +303,7 @@ var TextInput = function(parentNode, host) {
|
|||
host.renderer.$keepTextAreaAtCursor = null;
|
||||
|
||||
// on windows context menu is opened after mouseup
|
||||
if (useragent.isGecko && useragent.isWin)
|
||||
if (useragent.isWin && (useragent.isGecko || useragent.isIE))
|
||||
event.capture(host.container, function(e) {
|
||||
text.style.left = e.clientX - 2 + "px";
|
||||
text.style.top = e.clientY - 2 + "px";
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ var Gutter = function(parentEl) {
|
|||
breakpoints[i] ? " ace_breakpoint " : " ",
|
||||
annotation.className,
|
||||
"' title='", annotation.text.join("\n"),
|
||||
"' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>", (i+1));
|
||||
"' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>", (i));
|
||||
|
||||
if (foldWidgets) {
|
||||
var c = foldWidgets[i];
|
||||
|
|
@ -174,12 +174,32 @@ var Gutter = function(parentEl) {
|
|||
dom.removeCssClass(this.element, "ace_folding-enabled");
|
||||
|
||||
this.$showFoldWidgets = show;
|
||||
this.$padding = null;
|
||||
};
|
||||
|
||||
this.getShowFoldWidgets = function() {
|
||||
return this.$showFoldWidgets;
|
||||
};
|
||||
|
||||
this.$computePadding = function() {
|
||||
if (!this.element.firstChild)
|
||||
return {left: 0, right: 0};
|
||||
var style = dom.computedStyle(this.element.firstChild);
|
||||
this.$padding = {}
|
||||
this.$padding.left = parseInt(style.paddingLeft) + 1;
|
||||
this.$padding.right = parseInt(style.paddingRight);
|
||||
return this.$padding;
|
||||
};
|
||||
|
||||
this.getRegion = function(point) {
|
||||
var padding = this.$padding || this.$computePadding();
|
||||
var rect = this.element.getBoundingClientRect();
|
||||
if (point.x < padding.left + rect.left)
|
||||
return "markers";
|
||||
if (this.$showFoldWidgets && point.x > rect.right - padding.right)
|
||||
return "foldWidgets";
|
||||
};
|
||||
|
||||
}).call(Gutter.prototype);
|
||||
|
||||
exports.Gutter = Gutter;
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ var Text = function(parentEl) {
|
|||
|
||||
this.setSession = function(session) {
|
||||
this.session = session;
|
||||
this.$computeTabString();
|
||||
};
|
||||
|
||||
this.showInvisibles = false;
|
||||
|
|
@ -204,28 +205,52 @@ var Text = function(parentEl) {
|
|||
return false;
|
||||
|
||||
this.showInvisibles = showInvisibles;
|
||||
this.$computeTabString();
|
||||
return true;
|
||||
};
|
||||
|
||||
this.displayIndentGuides = true;
|
||||
this.setDisplayIndentGuides = function(display) {
|
||||
if (this.displayIndentGuides == display)
|
||||
return false;
|
||||
|
||||
this.displayIndentGuides = display;
|
||||
this.$computeTabString();
|
||||
return true;
|
||||
};
|
||||
|
||||
this.$tabStrings = [];
|
||||
this.onChangeTabSize =
|
||||
this.$computeTabString = function() {
|
||||
var tabSize = this.session.getTabSize();
|
||||
this.tabSize = tabSize;
|
||||
var tabStr = this.$tabStrings = [0];
|
||||
for (var i = 1; i < tabSize + 1; i++) {
|
||||
if (this.showInvisibles) {
|
||||
tabStr.push("<span class='ace_invisible'>"
|
||||
+ this.TAB_CHAR
|
||||
+ new Array(i).join(" ")
|
||||
+ Array(i).join(" ")
|
||||
+ "</span>");
|
||||
} else {
|
||||
tabStr.push(new Array(i+1).join(" "));
|
||||
}
|
||||
}
|
||||
if (this.displayIndentGuides) {
|
||||
this.$indentGuideRe = /\s\S| \t|\t |\s$/;
|
||||
var className = "ace_indent-guide";
|
||||
var content = Array(this.tabSize + 1).join(" ");
|
||||
var tabContent = content;
|
||||
if (this.showInvisibles) {
|
||||
className += " ace_invisible";
|
||||
tabContent = this.TAB_CHAR + content.substr(6);
|
||||
}
|
||||
|
||||
this.$tabStrings[" "] = "<span class='" + className + "'>" + content + "</span>";
|
||||
this.$tabStrings["\t"] = "<span class='" + className + "'>" + tabContent + "</span>";
|
||||
}
|
||||
};
|
||||
|
||||
this.updateLines = function(config, firstRow, lastRow) {
|
||||
this.$computeTabString();
|
||||
// Due to wrap line changes there can be new lines if e.g.
|
||||
// the line to updated wrapped in the meantime.
|
||||
if (this.config.lastRow != config.lastRow ||
|
||||
|
|
@ -253,22 +278,32 @@ var Text = function(parentEl) {
|
|||
lineElementsIdx ++;
|
||||
}
|
||||
|
||||
for (var i=first; i<=last; i++) {
|
||||
var row = first;
|
||||
var foldLine = this.session.getNextFoldLine(row);
|
||||
var foldStart = foldLine ? foldLine.start.row : Infinity;
|
||||
|
||||
while (true) {
|
||||
if (row > foldStart) {
|
||||
row = foldLine.end.row+1;
|
||||
foldLine = this.session.getNextFoldLine(row, foldLine);
|
||||
foldStart = foldLine ? foldLine.start.row :Infinity;
|
||||
}
|
||||
if (row > last)
|
||||
break;
|
||||
|
||||
var lineElement = lineElements[lineElementsIdx++];
|
||||
if (!lineElement)
|
||||
continue;
|
||||
|
||||
var html = [];
|
||||
var tokens = this.session.getTokens(i);
|
||||
this.$renderLine(html, i, tokens, !this.$useLineGroups());
|
||||
lineElement = dom.setInnerHtml(lineElement, html.join(""));
|
||||
|
||||
i = this.session.getRowFoldEnd(i);
|
||||
if (lineElement) {
|
||||
var html = [];
|
||||
this.$renderLine(
|
||||
html, row, !this.$useLineGroups(), row == foldStart ? foldLine : false
|
||||
);
|
||||
dom.setInnerHtml(lineElement, html.join(""));
|
||||
}
|
||||
row++;
|
||||
}
|
||||
};
|
||||
|
||||
this.scrollLines = function(config) {
|
||||
this.$computeTabString();
|
||||
var oldConfig = this.config;
|
||||
this.config = config;
|
||||
|
||||
|
|
@ -321,8 +356,7 @@ var Text = function(parentEl) {
|
|||
var html = [];
|
||||
// Get the tokens per line as there might be some lines in between
|
||||
// beeing folded.
|
||||
var tokens = this.session.getTokens(row);
|
||||
this.$renderLine(html, row, tokens, false);
|
||||
this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
|
||||
|
||||
// don't use setInnerHtml since we are working with an empty DIV
|
||||
container.innerHTML = html.join("");
|
||||
|
|
@ -341,7 +375,6 @@ var Text = function(parentEl) {
|
|||
};
|
||||
|
||||
this.update = function(config) {
|
||||
this.$computeTabString();
|
||||
this.config = config;
|
||||
|
||||
var html = [];
|
||||
|
|
@ -363,10 +396,7 @@ var Text = function(parentEl) {
|
|||
if (this.$useLineGroups())
|
||||
html.push("<div class='ace_line_group'>")
|
||||
|
||||
// Get the tokens per line as there might be some lines in between
|
||||
// beeing folded.
|
||||
var tokens = this.session.getTokens(row);
|
||||
this.$renderLine(html, row, tokens, false);
|
||||
this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
|
||||
|
||||
if (this.$useLineGroups())
|
||||
html.push("</div>"); // end the line group
|
||||
|
|
@ -429,38 +459,44 @@ var Text = function(parentEl) {
|
|||
return screenColumn + value.length;
|
||||
};
|
||||
|
||||
this.$renderLineCore = function(stringBuilder, lastRow, tokens, splits, onlyContents) {
|
||||
this.renderIndentGuide = function(stringBuilder, value) {
|
||||
var cols = value.search(this.$indentGuideRe);
|
||||
if (cols <= 0)
|
||||
return value;
|
||||
if (value[0] == " ") {
|
||||
cols -= cols % this.tabSize;
|
||||
stringBuilder.push(Array(cols/this.tabSize + 1).join(this.$tabStrings[" "]));
|
||||
return value.substr(cols);
|
||||
} else if (value[0] == "\t") {
|
||||
stringBuilder.push(Array(cols + 1).join(this.$tabStrings["\t"]));
|
||||
return value.substr(cols);
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
this.$renderWrappedLine = function(stringBuilder, tokens, splits, onlyContents) {
|
||||
var chars = 0;
|
||||
var split = 0;
|
||||
var splitChars;
|
||||
var splitChars = splits[0];
|
||||
var screenColumn = 0;
|
||||
var self = this;
|
||||
|
||||
if (!splits || splits.length == 0)
|
||||
splitChars = Number.MAX_VALUE;
|
||||
else
|
||||
splitChars = splits[0];
|
||||
|
||||
if (!onlyContents) {
|
||||
stringBuilder.push("<div class='ace_line' style='height:",
|
||||
this.config.lineHeight, "px",
|
||||
"'>"
|
||||
);
|
||||
}
|
||||
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
var token = tokens[i];
|
||||
var value = token.value;
|
||||
if (i == 0 && this.displayIndentGuides) {
|
||||
chars = value.length;
|
||||
value = this.renderIndentGuide(stringBuilder, value);
|
||||
if (!value)
|
||||
continue;
|
||||
chars -= value.length;
|
||||
}
|
||||
|
||||
if (chars + value.length < splitChars) {
|
||||
screenColumn = self.$renderToken(
|
||||
stringBuilder, screenColumn, token, value
|
||||
);
|
||||
screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
|
||||
chars += value.length;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
while (chars + value.length >= splitChars) {
|
||||
screenColumn = self.$renderToken(
|
||||
screenColumn = this.$renderToken(
|
||||
stringBuilder, screenColumn,
|
||||
token, value.substring(0, splitChars - chars)
|
||||
);
|
||||
|
|
@ -470,8 +506,7 @@ var Text = function(parentEl) {
|
|||
if (!onlyContents) {
|
||||
stringBuilder.push("</div>",
|
||||
"<div class='ace_line' style='height:",
|
||||
this.config.lineHeight, "px",
|
||||
"'>"
|
||||
this.config.lineHeight, "px'>"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -481,37 +516,70 @@ var Text = function(parentEl) {
|
|||
}
|
||||
if (value.length != 0) {
|
||||
chars += value.length;
|
||||
screenColumn = self.$renderToken(
|
||||
screenColumn = this.$renderToken(
|
||||
stringBuilder, screenColumn, token, value
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.$renderSimpleLine = function(stringBuilder, tokens) {
|
||||
var screenColumn = 0;
|
||||
var token = tokens[0];
|
||||
var value = token.value;
|
||||
if (this.displayIndentGuides)
|
||||
value = this.renderIndentGuide(stringBuilder, value);
|
||||
if (value)
|
||||
screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
|
||||
for (var i = 1; i < tokens.length; i++) {
|
||||
token = tokens[i];
|
||||
value = token.value;
|
||||
screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
|
||||
}
|
||||
};
|
||||
|
||||
// row is either first row of foldline or not in fold
|
||||
this.$renderLine = function(stringBuilder, row, onlyContents, foldLine) {
|
||||
if (!foldLine && foldLine != false)
|
||||
foldLine = this.session.getFoldLine(row);
|
||||
|
||||
if (foldLine)
|
||||
var tokens = this.$getFoldLineTokens(row, foldLine);
|
||||
else
|
||||
var tokens = this.session.getTokens(row);
|
||||
|
||||
|
||||
if (!onlyContents) {
|
||||
stringBuilder.push(
|
||||
"<div class='ace_line' style='height:", this.config.lineHeight, "px'>"
|
||||
);
|
||||
}
|
||||
|
||||
if (tokens.length) {
|
||||
var splits = this.session.getRowSplitData(row);
|
||||
if (splits && splits.length)
|
||||
this.$renderWrappedLine(stringBuilder, tokens, splits, onlyContents);
|
||||
else
|
||||
this.$renderSimpleLine(stringBuilder, tokens);
|
||||
}
|
||||
|
||||
if (this.showInvisibles) {
|
||||
if (lastRow !== this.session.getLength() - 1)
|
||||
stringBuilder.push("<span class='ace_invisible'>" + this.EOL_CHAR + "</span>");
|
||||
else
|
||||
stringBuilder.push("<span class='ace_invisible'>" + this.EOF_CHAR + "</span>");
|
||||
if (foldLine)
|
||||
row = foldLine.end.row
|
||||
|
||||
stringBuilder.push(
|
||||
"<span class='ace_invisible'>",
|
||||
row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR,
|
||||
"</span>"
|
||||
);
|
||||
}
|
||||
if (!onlyContents)
|
||||
stringBuilder.push("</div>");
|
||||
};
|
||||
|
||||
this.$renderLine = function(stringBuilder, row, tokens, onlyContents) {
|
||||
// Check if the line to render is folded or not. If not, things are
|
||||
// simple, otherwise, we need to fake some things...
|
||||
if (!this.session.isRowFolded(row)) {
|
||||
var splits = this.session.getRowSplitData(row);
|
||||
this.$renderLineCore(stringBuilder, row, tokens, splits, onlyContents);
|
||||
} else {
|
||||
this.$renderFoldLine(stringBuilder, row, tokens, onlyContents);
|
||||
}
|
||||
};
|
||||
|
||||
this.$renderFoldLine = function(stringBuilder, row, tokens, onlyContents) {
|
||||
this.$getFoldLineTokens = function(row, foldLine) {
|
||||
var session = this.session;
|
||||
var foldLine = session.getFoldLine(row);
|
||||
var renderTokens = [];
|
||||
|
||||
function addTokens(tokens, from, to) {
|
||||
|
|
@ -552,6 +620,7 @@ var Text = function(parentEl) {
|
|||
}
|
||||
}
|
||||
|
||||
var tokens = session.getTokens(row);
|
||||
foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
|
||||
if (placeholder) {
|
||||
renderTokens.push({
|
||||
|
|
@ -567,9 +636,7 @@ var Text = function(parentEl) {
|
|||
}
|
||||
}, foldLine.end.row, this.session.getLine(foldLine.end.row).length);
|
||||
|
||||
// splits for foldline are stored at its' first row
|
||||
var splits = this.session.$useWrapMode ? this.session.$wrapData[row] : null;
|
||||
this.$renderLineCore(stringBuilder, row, renderTokens, splits, onlyContents);
|
||||
return renderTokens;
|
||||
};
|
||||
|
||||
this.$useLineGroups = function() {
|
||||
|
|
|
|||
|
|
@ -67,35 +67,61 @@ module.exports = {
|
|||
this.textLayer.$computeTabString();
|
||||
|
||||
// row with hard tabs
|
||||
var row = 0;
|
||||
var tokens = this.session.getTokens(row);
|
||||
var stringBuilder = [];
|
||||
this.textLayer.$renderLine(stringBuilder, row, tokens);
|
||||
this.textLayer.$renderLine(stringBuilder, 0);
|
||||
|
||||
// row with soft tabs
|
||||
row = 1;
|
||||
tokens = this.session.getTokens(row);
|
||||
var stringBuilder2 = [];
|
||||
this.textLayer.$renderLine(stringBuilder2, row, tokens);
|
||||
this.textLayer.$renderLine(stringBuilder2, 1);
|
||||
assert.equal(stringBuilder.join(""), stringBuilder2.join(""));
|
||||
},
|
||||
|
||||
"test rendering width of ideographic space (U+3000)" : function() {
|
||||
this.session.setValue("\u3000");
|
||||
|
||||
var tokens = this.session.getTokens(0);
|
||||
var stringBuilder = [];
|
||||
this.textLayer.$renderLine(stringBuilder, 0, tokens, true);
|
||||
this.textLayer.$renderLine(stringBuilder, 0, true);
|
||||
assert.equal(stringBuilder.join(""), "<span class='ace_cjk' style='width:20px'></span>");
|
||||
|
||||
this.textLayer.setShowInvisibles(true);
|
||||
var stringBuilder = [];
|
||||
this.textLayer.$renderLine(stringBuilder, 0, tokens, true);
|
||||
this.textLayer.$renderLine(stringBuilder, 0, true);
|
||||
assert.equal(
|
||||
stringBuilder.join(""),
|
||||
"<span class='ace_cjk ace_invisible' style='width:20px'>" + this.textLayer.SPACE_CHAR + "</span>"
|
||||
+ "<span class='ace_invisible'>\xB6</span>"
|
||||
);
|
||||
},
|
||||
|
||||
"test rendering of indent guides" : function() {
|
||||
var textLayer = this.textLayer
|
||||
var EOL = "<span class='ace_invisible'>" + textLayer.EOL_CHAR + "</span>";
|
||||
var SPACE = function(i) {return Array(i+1).join(" ")}
|
||||
var TAB = function(i) {return textLayer.TAB_CHAR + SPACE(i-1)}
|
||||
function testRender(results) {
|
||||
for (var i = results.length; i--; ) {
|
||||
var stringBuilder = [];
|
||||
textLayer.$renderLine(stringBuilder, i, true);
|
||||
assert.equal(stringBuilder.join(""), results[i]);
|
||||
}
|
||||
}
|
||||
|
||||
this.session.setValue(" \n\t\tf\n ");
|
||||
testRender([
|
||||
"<span class='ace_indent-guide'>" + SPACE(4) + "</span>" + SPACE(2),
|
||||
"<span class='ace_indent-guide'>" + SPACE(4) + "</span>" + SPACE(4) + "<span class='ace_identifier'>f</span>",
|
||||
SPACE(3)
|
||||
]);
|
||||
this.textLayer.setShowInvisibles(true);
|
||||
testRender([
|
||||
"<span class='ace_indent-guide ace_invisible'>" + SPACE(4) + "</span>" + SPACE(2) + EOL,
|
||||
"<span class='ace_indent-guide ace_invisible'>" + TAB(4) + "</span><span class='ace_invisible'>" + TAB(4) + "</span><span class='ace_identifier'>f</span>" + EOL,
|
||||
]);
|
||||
this.textLayer.setDisplayIndentGuides(false);
|
||||
testRender([
|
||||
SPACE(6) + EOL,
|
||||
"<span class='ace_invisible'>" + TAB(4) + "</span><span class='ace_invisible'>" + TAB(4) + "</span><span class='ace_identifier'>f</span>" + EOL
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -108,11 +108,6 @@ exports.getButton = function(e) {
|
|||
|
||||
if (document.documentElement.setCapture) {
|
||||
exports.capture = function(el, eventHandler, releaseCaptureHandler) {
|
||||
function onMouseMove(e) {
|
||||
eventHandler(e);
|
||||
return exports.stopPropagation(e);
|
||||
}
|
||||
|
||||
var called = false;
|
||||
function onReleaseCapture(e) {
|
||||
eventHandler(e);
|
||||
|
|
@ -137,22 +132,17 @@ if (document.documentElement.setCapture) {
|
|||
}
|
||||
else {
|
||||
exports.capture = function(el, eventHandler, releaseCaptureHandler) {
|
||||
function onMouseMove(e) {
|
||||
eventHandler(e);
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function onMouseUp(e) {
|
||||
eventHandler && eventHandler(e);
|
||||
releaseCaptureHandler && releaseCaptureHandler(e);
|
||||
|
||||
document.removeEventListener("mousemove", onMouseMove, true);
|
||||
document.removeEventListener("mousemove", eventHandler, true);
|
||||
document.removeEventListener("mouseup", onMouseUp, true);
|
||||
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
document.addEventListener("mousemove", onMouseMove, true);
|
||||
document.addEventListener("mousemove", eventHandler, true);
|
||||
document.addEventListener("mouseup", onMouseUp, true);
|
||||
};
|
||||
}
|
||||
|
|
@ -193,7 +183,7 @@ exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbac
|
|||
4: "quadclick"
|
||||
};
|
||||
|
||||
var listener = function(e) {
|
||||
exports.addListener(el, "mousedown", function(e) {
|
||||
if (exports.getButton(e) != 0) {
|
||||
clicks = 0;
|
||||
} else {
|
||||
|
|
@ -219,10 +209,18 @@ exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbac
|
|||
clicks = 0;
|
||||
else if (clicks > 1)
|
||||
return eventHandler[callbackName](eventNames[clicks], e);
|
||||
};
|
||||
});
|
||||
|
||||
exports.addListener(el, "mousedown", listener);
|
||||
useragent.isOldIE && exports.addListener(el, "dblclick", listener);
|
||||
if (useragent.isOldIE) {
|
||||
exports.addListener(el, "dblclick", function(e) {
|
||||
clicks = 2;
|
||||
if (timer)
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
|
||||
eventHandler[callbackName]("mousedown", e);
|
||||
eventHandler[callbackName](eventNames[clicks], e);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function normalizeCommandKeys(callback, e, keyCode) {
|
||||
|
|
@ -292,7 +290,7 @@ exports.addCommandKeyListener = function(el, callback) {
|
|||
}
|
||||
};
|
||||
|
||||
if (window.postMessage) {
|
||||
if (window.postMessage && !useragent.isOldIE) {
|
||||
var postMessageId = 1;
|
||||
exports.nextTick = function(callback, win) {
|
||||
win = win || window;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ EventEmitter._dispatchEvent = function(eventName, e) {
|
|||
return;
|
||||
|
||||
e = e || {};
|
||||
e.type = eventName;
|
||||
if (!e.type)
|
||||
e.type = eventName;
|
||||
|
||||
if (!e.stopPropagation) {
|
||||
e.stopPropagation = function() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* based on code from:
|
||||
*
|
||||
*
|
||||
* @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
|
||||
* Available via the MIT or new BSD license.
|
||||
* see: http://github.com/jrburke/requirejs for details
|
||||
|
|
@ -8,6 +8,8 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var useragent = require("./useragent");
|
||||
|
||||
exports.get = function (url, callback) {
|
||||
var xhr = exports.createXhr();
|
||||
xhr.open('GET', url, true);
|
||||
|
|
@ -55,8 +57,13 @@ exports.loadScript = function(path, callback) {
|
|||
|
||||
s.src = path;
|
||||
head.appendChild(s);
|
||||
|
||||
s.onload = callback;
|
||||
|
||||
if (useragent.isOldIE)
|
||||
s.onreadystatechange = function () {
|
||||
this.readyState == 'loaded' && callback();
|
||||
};
|
||||
else
|
||||
s.onload = callback;
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -28,39 +28,39 @@ define(function(require, exports, module) {
|
|||
this.inherit(CstyleBehaviour, ["braces", "parens", "string_dquotes"]); // Get string behaviour
|
||||
this.parent = parent;
|
||||
|
||||
this.add("brackets", "insertion", function (state, action, editor, session, text) {
|
||||
if (text == "\n") {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
var rightChars = line.substring(cursor.column, cursor.column + 2);
|
||||
if (rightChars == '</') {
|
||||
var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
|
||||
var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
|
||||
|
||||
return {
|
||||
text: '\n' + indent + '\n' + next_indent,
|
||||
selection: [1, indent.length, 1, indent.length]
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
// this.add("brackets", "insertion", function (state, action, editor, session, text) {
|
||||
// if (text == "\n") {
|
||||
// var cursor = editor.getCursorPosition();
|
||||
// var line = session.doc.getLine(cursor.row);
|
||||
// var rightChars = line.substring(cursor.column, cursor.column + 2);
|
||||
// if (rightChars == '</') {
|
||||
// var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
|
||||
// var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
|
||||
//
|
||||
// return {
|
||||
// text: '\n' + indent + '\n' + next_indent,
|
||||
// selection: [1, indent.length, 1, indent.length]
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// });
|
||||
|
||||
// Check for open tag if user enters / and auto-close it.
|
||||
this.add("slash", "insertion", function (state, action, editor, session, text) {
|
||||
if (text == "/") {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
if (cursor.column > 0 && line.charAt(cursor.column - 1) == "<") {
|
||||
line = line.substring(0, cursor.column) + "/" + line.substring(cursor.column);
|
||||
var lines = session.doc.getAllLines();
|
||||
lines[cursor.row] = line;
|
||||
// call mode helper to close the tag if possible
|
||||
parent.exec("closeTag", lines.join(session.doc.getNewLineCharacter()), cursor.row);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
// this.add("slash", "insertion", function (state, action, editor, session, text) {
|
||||
// if (text == "/") {
|
||||
// var cursor = editor.getCursorPosition();
|
||||
// var line = session.doc.getLine(cursor.row);
|
||||
// if (cursor.column > 0 && line.charAt(cursor.column - 1) == "<") {
|
||||
// line = line.substring(0, cursor.column) + "/" + line.substring(cursor.column);
|
||||
// var lines = session.doc.getAllLines();
|
||||
// lines[cursor.row] = line;
|
||||
// // call mode helper to close the tag if possible
|
||||
// parent.exec("closeTag", lines.join(session.doc.getNewLineCharacter()), cursor.row);
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// });
|
||||
}
|
||||
oop.inherits(XQueryBehaviour, Behaviour);
|
||||
|
||||
|
|
|
|||
|
|
@ -190,10 +190,7 @@ var ClojureHighlightRules = function() {
|
|||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
}, {
|
||||
token : "string", // multi line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?$',
|
||||
regex : '"',
|
||||
next: "string"
|
||||
}, {
|
||||
token : "string", // symbol
|
||||
|
|
@ -217,12 +214,16 @@ var ClojureHighlightRules = function() {
|
|||
],
|
||||
"string" : [
|
||||
{
|
||||
token : "string",
|
||||
token : "constant.language.escape",
|
||||
merge : true,
|
||||
regex : "\\\\."
|
||||
regex : "\\\\.|\\\\$"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]*?"',
|
||||
merge : true,
|
||||
regex : '[^"\\\\]+'
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -48,18 +48,19 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
|
||||
(function() {
|
||||
|
||||
this.foldingStartMarker = /^(\w.*\:|Searching for.*)$/;
|
||||
this.foldingStartMarker = /^(\S.*\:|Searching for.*)$/;
|
||||
this.foldingStopMarker = /^(\s+|Found.*)$/;
|
||||
|
||||
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||
var line = session.getLine(row);
|
||||
var lines = session.doc.getAllLines(row);
|
||||
var line = lines[row];
|
||||
var level1 = /^(Found.*|Searching for.*)$/;
|
||||
var level2 = /^(\w.*\:|\s*)$/;
|
||||
var level2 = /^(\S.*\:|\s*)$/;
|
||||
var re = level1.test(line) ? level1 : level2;
|
||||
|
||||
if (this.foldingStartMarker.test(line)) {
|
||||
for (var i = row + 1, l = session.getLength(); i < l; i++) {
|
||||
if (re.test(session.getLine(i)))
|
||||
if (re.test(lines[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +69,7 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
|
||||
if (this.foldingStopMarker.test(line)) {
|
||||
for (var i = row - 1; i >= 0; i--) {
|
||||
line = session.getLine(i);
|
||||
line = lines[i];
|
||||
if (re.test(line))
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,15 +44,11 @@ function GutterHandler(mouseHandler) {
|
|||
var editor = mouseHandler.editor;
|
||||
|
||||
mouseHandler.editor.setDefaultHandler("guttermousedown", function(e) {
|
||||
var target = e.domEvent.target;
|
||||
if (target.className.indexOf("ace_gutter-cell") == -1)
|
||||
return;
|
||||
|
||||
if (!editor.isFocused())
|
||||
return;
|
||||
var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
|
||||
|
||||
var padding = parseInt(dom.computedStyle(target).paddingLeft);
|
||||
if (e.x < padding + target.getBoundingClientRect().left + 1)
|
||||
if (gutterRegion)
|
||||
return;
|
||||
|
||||
var row = e.getDocumentPosition().row;
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ function DefaultHandlers(mouseHandler) {
|
|||
var editor = this.editor;
|
||||
|
||||
if (distance > DRAG_OFFSET) {
|
||||
this.startSelect();
|
||||
this.startSelect(this.mousedownEvent.getDocumentPosition());
|
||||
} else if (time - this.mousedownEvent.time > editor.getDragDelay()) {
|
||||
this.startDrag();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,9 +58,13 @@ function FoldHandler(editor) {
|
|||
});
|
||||
|
||||
editor.on("gutterclick", function(e) {
|
||||
if (e.domEvent.target.className.indexOf("ace_fold-widget") != -1) {
|
||||
var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
|
||||
|
||||
if (gutterRegion == "foldWidgets") {
|
||||
var row = e.getDocumentPosition().row;
|
||||
editor.session.onFoldWidgetClick(row, e.domEvent);
|
||||
var session = editor.session;
|
||||
if (session.foldWidgets && session.foldWidgets[row])
|
||||
editor.session.onFoldWidgetClick(row, e);
|
||||
e.stop();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ define(function(require, exports, module) {
|
|||
"use strict";
|
||||
|
||||
var event = require("../lib/event");
|
||||
var useragent = require("../lib/useragent");
|
||||
var DefaultHandlers = require("./default_handlers").DefaultHandlers;
|
||||
var DefaultGutterHandler = require("./default_gutter_handler").GutterHandler;
|
||||
var MouseEvent = require("./mouse_event").MouseEvent;
|
||||
|
|
@ -148,6 +149,14 @@ var MouseHandler = function(editor) {
|
|||
var onCaptureInterval = function() {
|
||||
self[self.state] && self[self.state]();
|
||||
}
|
||||
|
||||
if (useragent.isOldIE && ev.domEvent.type == "dblclick") {
|
||||
setTimeout(function() {
|
||||
onCaptureInterval();
|
||||
onCaptureEnd(ev.domEvent);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
event.capture(this.editor.container, onMouseMove, onCaptureEnd);
|
||||
var timerId = setInterval(onCaptureInterval, 20);
|
||||
|
|
|
|||
|
|
@ -502,7 +502,11 @@ var Editor = require("./editor").Editor;
|
|||
return text;
|
||||
};
|
||||
|
||||
// todo this should change when paste becomes a command
|
||||
this.onPaste = function(text) {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
this._emit("paste", text);
|
||||
if (!this.inMultiSelectMode)
|
||||
return this.insert(text);
|
||||
|
|
|
|||
|
|
@ -137,23 +137,24 @@ var Search = function() {
|
|||
return [];
|
||||
this.$assembleRegExp(options);
|
||||
|
||||
if (options.range) {
|
||||
var range = options.range;
|
||||
var lines = session.getLines(range.start.row, range.end.row);
|
||||
} else
|
||||
var lines = session.doc.getAllLines();
|
||||
var range = options.range;
|
||||
var lines = range
|
||||
? session.getLines(range.start.row, range.end.row)
|
||||
: session.doc.getAllLines();
|
||||
|
||||
var ranges = [];
|
||||
var re = options.re;
|
||||
if (options.$isMultiLine) {
|
||||
var len = re.length;
|
||||
var maxRow = lines.length - len;
|
||||
for (var row = re.offset || 0; row < maxRow; row++) {
|
||||
for (var j = 0; j < re.length; j++)
|
||||
for (var row = re.offset || 0; row <= maxRow; row++) {
|
||||
for (var j = 0; j < len; j++)
|
||||
if (lines[row + j].search(re[j]) == -1)
|
||||
break;
|
||||
|
||||
var startIndex = lines[row + j].match(re[0])[0].length;
|
||||
|
||||
var startLine = lines[row];
|
||||
var line = lines[row + len - 1];
|
||||
var startIndex = startLine.match(re[0])[0].length;
|
||||
var endIndex = line.match(re[len - 1])[0].length;
|
||||
|
||||
ranges.push(new Range(
|
||||
|
|
@ -167,11 +168,11 @@ var Search = function() {
|
|||
for (var j = 0; j < matches.length; j++) {
|
||||
var match = matches[j];
|
||||
ranges.push(new Range(i, match.offset, i, match.offset + match.length));
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (options.range) {
|
||||
if (range) {
|
||||
var startColumn = range.start.column;
|
||||
var endColumn = range.start.column;
|
||||
var i = 0, j = ranges.length - 1;
|
||||
|
|
@ -210,7 +211,7 @@ var Search = function() {
|
|||
if (!match || match[0].length != input.length)
|
||||
return null;
|
||||
|
||||
replacement = input.replace(re, replacement)
|
||||
replacement = input.replace(re, replacement);
|
||||
if (options.preserveCase) {
|
||||
replacement = replacement.split("");
|
||||
for (var i = Math.min(input.length, input.length); i--; ) {
|
||||
|
|
@ -261,21 +262,21 @@ var Search = function() {
|
|||
|
||||
if (callback(range))
|
||||
return true;
|
||||
}
|
||||
};
|
||||
} else if (backwards) {
|
||||
var matchIterator = function(line, row, startIndex) {
|
||||
var matches = lang.getMatchOffsets(line, re);
|
||||
for (var i = matches.length-1; i >= 0; i--)
|
||||
if (callback(matches[i], row, startIndex))
|
||||
return true;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var matchIterator = function(line, row, startIndex) {
|
||||
var matches = lang.getMatchOffsets(line, re);
|
||||
for (var i = 0; i < matches.length; i++)
|
||||
if (callback(matches[i], row, startIndex))
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
@ -310,7 +311,7 @@ var Search = function() {
|
|||
try {
|
||||
var re = new RegExp(needle, modifier);
|
||||
} catch(e) {
|
||||
var re = false;
|
||||
re = false;
|
||||
}
|
||||
return options.re = re;
|
||||
};
|
||||
|
|
@ -333,7 +334,6 @@ var Search = function() {
|
|||
};
|
||||
|
||||
this.$lineIterator = function(session, options) {
|
||||
var range = options.range;
|
||||
var backwards = options.backwards == true;
|
||||
var skipCurrent = options.skipCurrent != false;
|
||||
|
||||
|
|
@ -346,30 +346,9 @@ var Search = function() {
|
|||
start = start[skipCurrent != backwards ? "end" : "start"];
|
||||
|
||||
var firstRow = range ? range.start.row : 0;
|
||||
var firstColumn = range ? range.start.column : 0;
|
||||
var lastRow = range ? range.end.row : session.getLength() - 1;
|
||||
|
||||
if (!backwards) {
|
||||
var forEach = function(callback) {
|
||||
var row = start.row;
|
||||
|
||||
var line = session.getLine(row).substr(start.column);
|
||||
if (callback(line, row, start.column))
|
||||
return;
|
||||
|
||||
for (row = row+1; row <= lastRow; row++)
|
||||
if (callback(session.getLine(row), row))
|
||||
return;
|
||||
|
||||
if (options.wrap == false)
|
||||
return;
|
||||
|
||||
for (row = firstRow, lastRow = start.row; row <= lastRow; row++)
|
||||
if (callback(session.getLine(row), row))
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
var forEach = function(callback) {
|
||||
var forEach = backwards ? function(callback) {
|
||||
var row = start.row;
|
||||
|
||||
var line = session.getLine(row).substring(0, start.column);
|
||||
|
|
@ -386,9 +365,25 @@ var Search = function() {
|
|||
for (row = lastRow, firstRow = start.row; row >= firstRow; row--)
|
||||
if (callback(session.getLine(row), row))
|
||||
return;
|
||||
}
|
||||
}
|
||||
} : function(callback) {
|
||||
var row = start.row;
|
||||
|
||||
var line = session.getLine(row).substr(start.column);
|
||||
if (callback(line, row, start.column))
|
||||
return;
|
||||
|
||||
for (row = row+1; row <= lastRow; row++)
|
||||
if (callback(session.getLine(row), row))
|
||||
return;
|
||||
|
||||
if (options.wrap == false)
|
||||
return;
|
||||
|
||||
for (row = firstRow, lastRow = start.row; row <= lastRow; row++)
|
||||
if (callback(session.getLine(row), row))
|
||||
return;
|
||||
};
|
||||
|
||||
return {forEach: forEach};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -339,6 +339,24 @@ module.exports = {
|
|||
assert.position(ranges[1].start, 2, 1);
|
||||
assert.position(ranges[1].end, 2, 3);
|
||||
},
|
||||
|
||||
|
||||
"test: find all multiline matches" : function() {
|
||||
var session = new EditSession(["juhu", "juhu", "juhu", "juhu"]);
|
||||
|
||||
var search = new Search().set({
|
||||
needle: "hu\nju",
|
||||
wrap: true
|
||||
});
|
||||
|
||||
var ranges = search.findAll(session);
|
||||
|
||||
assert.equal(ranges.length, 3);
|
||||
assert.position(ranges[0].start, 0, 2);
|
||||
assert.position(ranges[0].end, 1, 2);
|
||||
assert.position(ranges[1].start, 1, 2);
|
||||
assert.position(ranges[1].end, 2, 2);
|
||||
},
|
||||
|
||||
"test: replace() should return the replacement if the input matches the needle" : function() {
|
||||
var search = new Search().set({
|
||||
|
|
|
|||
|
|
@ -115,10 +115,10 @@ MockRenderer.prototype.scrollToX = function(scrollTop) {};
|
|||
MockRenderer.prototype.scrollToY = function(scrollLeft) {};
|
||||
|
||||
MockRenderer.prototype.scrollToLine = function(line, center) {
|
||||
var lineHeight = { lineHeight: 16 };
|
||||
var lineHeight = 16;
|
||||
var row = 0;
|
||||
for (var l = 1; l < line; l++) {
|
||||
row += this.session.getRowHeight(lineHeight, l-1) / lineHeight.lineHeight;
|
||||
row += this.session.getRowLength(l-1);
|
||||
}
|
||||
|
||||
if (center) {
|
||||
|
|
@ -154,6 +154,9 @@ MockRenderer.prototype.getScrollTopRow = function() {
|
|||
MockRenderer.prototype.draw = function() {
|
||||
};
|
||||
|
||||
MockRenderer.prototype.onChangeTabSize = function(startRow, endRow) {
|
||||
};
|
||||
|
||||
MockRenderer.prototype.updateLines = function(startRow, endRow) {
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -156,4 +156,8 @@ color:#FD971F;
|
|||
|
||||
.ace-chrome .ace_entity.ace_other.ace_attribute-name{
|
||||
color: #994409;
|
||||
}
|
||||
}
|
||||
|
||||
.ace-chrome .ace_indent-guide {
|
||||
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,4 +115,8 @@
|
|||
|
||||
.ace-clouds .ace_markup.ace_underline {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.ace-clouds .ace_indent-guide {
|
||||
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;
|
||||
}
|
||||
|
|
@ -116,4 +116,8 @@ background-color:#E92E2E;
|
|||
|
||||
.ace-clouds-midnight .ace_markup.ace_underline {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.ace-clouds-midnight .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWOQlJT8z1BeXv4fAA2KA6+h9Z+2AAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -142,4 +142,8 @@ background-color:#001221;
|
|||
|
||||
.ace-cobalt .ace_markup.ace_list {
|
||||
background-color:#130D26;
|
||||
}
|
||||
|
||||
.ace-cobalt .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgUHL4zzBz5sz/AA80BCzv+WXhAAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -148,4 +148,8 @@
|
|||
|
||||
.ace-crimson-editor .ace_string.ace_regex {
|
||||
color: rgb(192, 0, 192);
|
||||
}
|
||||
|
||||
.ace-crimson-editor .ace_indent-guide {
|
||||
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;
|
||||
}
|
||||
|
|
@ -146,4 +146,8 @@ color:#5A525F;
|
|||
|
||||
.ace-dawn .ace_markup.ace_list {
|
||||
color:#693A17;
|
||||
}
|
||||
|
||||
.ace-dawn .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4+fPnf4ZVq1b9BwAkVQboFQv98gAAAABJRU5ErkJggg==) right repeat-y;
|
||||
}
|
||||
|
|
@ -179,4 +179,8 @@
|
|||
|
||||
.ace-dreamweaver .ace_string.ace_regex {
|
||||
color: rgb(255, 0, 0)
|
||||
}
|
||||
|
||||
.ace-dreamweaver .ace_indent-guide {
|
||||
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;
|
||||
}
|
||||
|
|
@ -99,4 +99,8 @@
|
|||
|
||||
.ace-eclipse .ace_marker-layer .ace_active_line {
|
||||
background: rgb(232, 242, 254);
|
||||
}
|
||||
|
||||
.ace-eclipse .ace_indent-guide {
|
||||
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;
|
||||
}
|
||||
|
|
@ -130,4 +130,8 @@
|
|||
.ace-github .ace_print_margin {
|
||||
width: 1px;
|
||||
background: #e8e8e8;
|
||||
}
|
||||
|
||||
.ace-github .ace_indent-guide {
|
||||
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;
|
||||
}
|
||||
|
|
@ -133,5 +133,9 @@ color:#BC9458;
|
|||
|
||||
.ace-idle-fingers .ace_collab.ace_user1 {
|
||||
color:#323232;
|
||||
background-color:#FFF980;
|
||||
background-color:#FFF980;
|
||||
}
|
||||
|
||||
.ace-idle-fingers .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMwMjL6zzBz5sz/ABEUBGCqhK6UAAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -137,4 +137,8 @@ color:#706D5B;
|
|||
|
||||
.ace-kr-theme .ace_markup.ace_list {
|
||||
background-color:#0F0040;
|
||||
}
|
||||
|
||||
.ace-kr-theme .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPg5uL8zzBz5sz/AA1WA+hUYIqjAAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -137,4 +137,8 @@ color:#AD2EA4;
|
|||
|
||||
.ace-merbivore .ace_markup.ace_underline {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.ace-merbivore .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMQExP7zzBz5sz/AA50BAyDznYhAAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -143,4 +143,8 @@ color:#AC4BB8;
|
|||
|
||||
.ace-merbivore-soft .ace_markup.ace_underline {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.ace-merbivore-soft .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWOQkZH5zzBz5sz/AA8EBB6crd1rAAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -145,4 +145,8 @@ background-color:#151C19;
|
|||
|
||||
.ace-mono-industrial .ace_markup.ace_underline {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.ace-mono-industrial .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNQ0tH4zzBz5sz/ABAOBECKH+evAAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -142,4 +142,8 @@ color:#FD971F;
|
|||
|
||||
.ace-monokai .ace_markup.ace_underline {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.ace-monokai .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNQ11D6z7Bq1ar/ABCKBG6g04U2AAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -147,4 +147,8 @@ color:#D2A8A1;
|
|||
|
||||
.ace-pastel-on-dark .ace_markup.ace_underline {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.ace-pastel-on-dark .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0dD4z9DR0fEfAA+vBBPqhbn1AAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -128,4 +128,8 @@ color:#657B83;
|
|||
|
||||
.ace-solarized-dark .ace_markup.ace_underline {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.ace-solarized-dark .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNg0Db7zzBz5sz/AA82BCv7wOIDAAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -127,4 +127,8 @@
|
|||
|
||||
.ace-solarized-light .ace_markup.ace_underline {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.ace-solarized-light .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4++3xf4ZVq1b9BwAjxwbT1g3hiwAAAABJRU5ErkJggg==) right repeat-y;
|
||||
}
|
||||
|
|
@ -157,9 +157,13 @@
|
|||
}
|
||||
|
||||
.ace-tm .ace_meta.ace_tag {
|
||||
color:rgb(0, 50, 198);
|
||||
color:rgb(0, 22, 142);
|
||||
}
|
||||
|
||||
.ace-tm .ace_string.ace_regex {
|
||||
color: rgb(255, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
.ace-tm .ace_indent-guide {
|
||||
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,4 +161,8 @@ background-color:#8959A8;
|
|||
|
||||
.ace-tomorrow .ace_markup.ace_heading {
|
||||
color:#718C00;
|
||||
}
|
||||
|
||||
.ace-tomorrow .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bdu3f/BwAlfgctduB85QAAAABJRU5ErkJggg==) right repeat-y;
|
||||
}
|
||||
|
|
@ -161,4 +161,8 @@ background-color:#B798BF;
|
|||
|
||||
.ace-tomorrow-night .ace_markup.ace_heading {
|
||||
color:#B5BD68;
|
||||
}
|
||||
|
||||
.ace-tomorrow-night .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWOQlVf8z7Bq1ar/AA/hBFp7egmpAAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -161,4 +161,8 @@ background-color:#EBBBFF;
|
|||
|
||||
.ace-tomorrow-night-blue .ace_markup.ace_heading {
|
||||
color:#D1F1A9;
|
||||
}
|
||||
|
||||
.ace-tomorrow-night-blue .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgUAn8z7Bq1ar/ABBUBHJ4/r3JAAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -161,4 +161,8 @@ background-color:#B798BF;
|
|||
|
||||
.ace-tomorrow-night-bright .ace_markup.ace_heading {
|
||||
color:#B9CA4A;
|
||||
}
|
||||
|
||||
.ace-tomorrow-night-bright .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGD4z7Bq1ar/AAz9A/2naJQKAAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -157,4 +157,8 @@ background-color:#CC99CC;
|
|||
|
||||
.ace-tomorrow-night-eighties .ace_markup.ace_heading {
|
||||
color:#99CC99;
|
||||
}
|
||||
|
||||
.ace-tomorrow-night-eighties .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ1dX9z7Bq1ar/ABE1BITwhhuFAAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -159,4 +159,8 @@ color:#5F5A60;
|
|||
|
||||
.ace-twilight .ace_markup.ace_list {
|
||||
color:#F9EE98;
|
||||
}
|
||||
|
||||
.ace-twilight .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMQERH5zzBz5sz/AA5EBAYqeZXWAAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -138,4 +138,8 @@ color:#99CC99;
|
|||
|
||||
.ace-vibrant-ink .ace_markup.ace_underline {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.ace-vibrant-ink .ace_indent-guide {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPg5+f/z7Bq1ar/AA5lBCqoLxsgAAAAAElFTkSuQmCC) right repeat-y;
|
||||
}
|
||||
|
|
@ -102,9 +102,9 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.content.className = "ace_content";
|
||||
this.scroller.appendChild(this.content);
|
||||
|
||||
this.setHighlightGutterLine(true);
|
||||
this.$gutterLayer = new GutterLayer(this.$gutter);
|
||||
this.$gutterLayer.on("changeGutterWidth", this.onResize.bind(this, true));
|
||||
this.setFadeFoldWidgets(true);
|
||||
|
||||
this.$markerBack = new MarkerLayer(this.content);
|
||||
|
||||
|
|
@ -249,6 +249,11 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.$loop.schedule(this.CHANGE_LINES);
|
||||
};
|
||||
|
||||
this.onChangeTabSize = function() {
|
||||
this.$loop.schedule(this.CHANGE_TEXT | this.CHANGE_MARKER);
|
||||
this.$textLayer.onChangeTabSize();
|
||||
};
|
||||
|
||||
/**
|
||||
* VirtualRenderer.updateText() -> Void
|
||||
*
|
||||
|
|
@ -388,6 +393,15 @@ var VirtualRenderer = function(container, theme) {
|
|||
return this.$textLayer.showInvisibles;
|
||||
};
|
||||
|
||||
this.getDisplayIndentGuides = function() {
|
||||
return this.$textLayer.displayIndentGuides;
|
||||
};
|
||||
|
||||
this.setDisplayIndentGuides = function(display) {
|
||||
if (this.$textLayer.setDisplayIndentGuides(display))
|
||||
this.$loop.schedule(this.CHANGE_TEXT);
|
||||
};
|
||||
|
||||
this.$showPrintMargin = true;
|
||||
|
||||
/**
|
||||
|
|
@ -468,38 +482,32 @@ var VirtualRenderer = function(container, theme) {
|
|||
dom.removeCssClass(this.$gutter, "ace_fade-fold-widgets");
|
||||
};
|
||||
|
||||
this.$highlightGutterLine = true;
|
||||
this.$highlightGutterLine = false;
|
||||
this.setHighlightGutterLine = function(shouldHighlight) {
|
||||
if (this.$highlightGutterLine == shouldHighlight)
|
||||
return;
|
||||
this.$highlightGutterLine = shouldHighlight;
|
||||
|
||||
this.$loop.schedule(this.CHANGE_GUTTER);
|
||||
if (!this.$gutterLineHighlight) {
|
||||
this.$gutterLineHighlight = dom.createElement("div");
|
||||
this.$gutterLineHighlight.className = "ace_gutter_active_line";
|
||||
this.$gutter.appendChild(this.$gutterLineHighlight);
|
||||
return;
|
||||
}
|
||||
|
||||
this.$gutterLineHighlight.style.display = shouldHighlight ? "" : "none";
|
||||
// if cursorlayer have never been updated there's nothing on screen to update
|
||||
if (this.$cursorLayer.$pixelPos)
|
||||
this.$updateGutterLineHighlight();
|
||||
};
|
||||
|
||||
this.getHighlightGutterLine = function() {
|
||||
return this.$highlightGutterLine;
|
||||
};
|
||||
|
||||
this.$updateGutterLineHighlight = function(gutterReady) {
|
||||
var i = this.session.selection.lead.row;
|
||||
if (i == this.$gutterLineHighlight)
|
||||
return;
|
||||
|
||||
if (!gutterReady) {
|
||||
var lineEl, ch = this.$gutterLayer.element.children;
|
||||
var index = this.$gutterLineHighlight - this.layerConfig.firstRow;
|
||||
if (index >= 0 && (lineEl = ch[index]))
|
||||
dom.removeCssClass(lineEl, "ace_gutter_active_line");
|
||||
|
||||
index = i - this.layerConfig.firstRow;
|
||||
if (index >= 0 && (lineEl = ch[index]))
|
||||
dom.addCssClass(lineEl, "ace_gutter_active_line");
|
||||
}
|
||||
|
||||
this.$gutterLayer.removeGutterDecoration(this.$gutterLineHighlight, "ace_gutter_active_line");
|
||||
this.$gutterLayer.addGutterDecoration(i, "ace_gutter_active_line");
|
||||
this.$gutterLineHighlight = i;
|
||||
this.$updateGutterLineHighlight = function() {
|
||||
this.$gutterLineHighlight.style.top = this.$cursorLayer.$pixelPos.top - this.layerConfig.offset + "px";
|
||||
this.$gutterLineHighlight.style.height = this.layerConfig.lineHeight + "px";
|
||||
};
|
||||
|
||||
this.$updatePrintMargin = function() {
|
||||
|
|
@ -693,15 +701,13 @@ var VirtualRenderer = function(container, theme) {
|
|||
// update scrollbar first to not lose scroll position when gutter calls resize
|
||||
this.$updateScrollBar();
|
||||
this.$textLayer.update(this.layerConfig);
|
||||
if (this.showGutter) {
|
||||
if (this.$highlightGutterLine)
|
||||
this.$updateGutterLineHighlight(true);
|
||||
if (this.showGutter)
|
||||
this.$gutterLayer.update(this.layerConfig);
|
||||
}
|
||||
this.$markerBack.update(this.layerConfig);
|
||||
this.$markerFront.update(this.layerConfig);
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$moveTextAreaToCursor();
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -713,15 +719,13 @@ var VirtualRenderer = function(container, theme) {
|
|||
else
|
||||
this.$textLayer.scrollLines(this.layerConfig);
|
||||
|
||||
if (this.showGutter) {
|
||||
if (this.$highlightGutterLine)
|
||||
this.$updateGutterLineHighlight(true);
|
||||
if (this.showGutter)
|
||||
this.$gutterLayer.update(this.layerConfig);
|
||||
}
|
||||
this.$markerBack.update(this.layerConfig);
|
||||
this.$markerFront.update(this.layerConfig);
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$moveTextAreaToCursor();
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -744,7 +748,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
if (changes & this.CHANGE_CURSOR) {
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$moveTextAreaToCursor();
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight(false);
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
||||
}
|
||||
|
||||
if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
|
||||
|
|
@ -786,7 +790,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
|
||||
// Map lines on the screen to lines in the document.
|
||||
var firstRowScreen, firstRowHeight;
|
||||
var lineHeight = { lineHeight: this.lineHeight };
|
||||
var lineHeight = this.lineHeight;
|
||||
firstRow = session.screenToDocumentRow(firstRow, 0);
|
||||
|
||||
// Check if firstRow is inside of a foldLine. If true, then use the first
|
||||
|
|
@ -797,13 +801,13 @@ var VirtualRenderer = function(container, theme) {
|
|||
}
|
||||
|
||||
firstRowScreen = session.documentToScreenRow(firstRow, 0);
|
||||
firstRowHeight = session.getRowHeight(lineHeight, firstRow);
|
||||
firstRowHeight = session.getRowLength(firstRow) * lineHeight;
|
||||
|
||||
lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
|
||||
minHeight = this.$size.scrollerHeight + session.getRowHeight(lineHeight, lastRow)+
|
||||
minHeight = this.$size.scrollerHeight + session.getRowLength(lastRow) * lineHeight +
|
||||
firstRowHeight;
|
||||
|
||||
offset = this.scrollTop - firstRowScreen * this.lineHeight;
|
||||
offset = this.scrollTop - firstRowScreen * lineHeight;
|
||||
|
||||
this.layerConfig = {
|
||||
width : longestLine,
|
||||
|
|
@ -811,7 +815,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
firstRow : firstRow,
|
||||
firstRowScreen: firstRowScreen,
|
||||
lastRow : lastRow,
|
||||
lineHeight : this.lineHeight,
|
||||
lineHeight : lineHeight,
|
||||
characterWidth : this.characterWidth,
|
||||
minHeight : minHeight,
|
||||
maxHeight : maxHeight,
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ var require = function(parentId, id) {
|
|||
var module = require.modules[id];
|
||||
if (module) {
|
||||
if (!module.initialized) {
|
||||
module.exports = module.factory().exports;
|
||||
module.initialized = true;
|
||||
module.exports = module.factory().exports;
|
||||
}
|
||||
return module.exports;
|
||||
}
|
||||
|
|
@ -56,6 +56,10 @@ require.tlns = {};
|
|||
var define = function(id, deps, factory) {
|
||||
if (arguments.length == 2) {
|
||||
factory = deps;
|
||||
if (typeof id != "string") {
|
||||
deps = id;
|
||||
id = require.id;
|
||||
}
|
||||
} else if (arguments.length == 1) {
|
||||
factory = id;
|
||||
id = require.id;
|
||||
|
|
|
|||
|
|
@ -114,6 +114,8 @@ var WorkerClient = function(topLevelNamespaces, mod, classname) {
|
|||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.$normalizePath = function(path) {
|
||||
if (!location.host) // needed for file:// protocol
|
||||
return path;
|
||||
path = path.replace(/^[a-z]+:\/\/[^\/]+/, ""); // Remove domain name and rebuild it
|
||||
path = location.protocol + "//" + location.host
|
||||
// paths starting with a slash are relative to the root (host)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"description": "Ajax.org Code Editor is a full featured source code highlighting editor that powers the Cloud9 IDE",
|
||||
"version": "0.2.0",
|
||||
"homepage" : "http://github.com/ajaxorg/ace",
|
||||
"engines": {"node": ">= 0.4.0"},
|
||||
"engines": {"node": ">= 0.6.0"},
|
||||
"author": "Fabian Jakobs <fabian@ajax.org>",
|
||||
"main": "lib/ace",
|
||||
"repository" : {
|
||||
|
|
@ -19,9 +19,6 @@
|
|||
"dryice": "",
|
||||
"panino" : "~1.0.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": "~0.6.0"
|
||||
},
|
||||
"mappings": {
|
||||
"ace": "."
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue