diff --git a/Makefile.dryice.js b/Makefile.dryice.js
index 218cd7ef..1e7952a9 100755
--- a/Makefile.dryice.js
+++ b/Makefile.dryice.js
@@ -476,7 +476,7 @@ var detectTextModules = function(input, source) {
input = input.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
input = input.replace(/\n\s+/g, "\n");
- input = '"' + input.replace(/\n/g, '\\\n') + '"';
+ input = '"' + input.replace(/\r?\n/g, '\\\n') + '"';
textModules[module] = input;
return "";
diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js
index 183a872a..9ae70f4f 100644
--- a/demo/kitchen-sink/demo.js
+++ b/demo/kitchen-sink/demo.js
@@ -356,6 +356,9 @@ bindCheckbox("enable_behaviours", function(checked) {
bindCheckbox("fade_fold_widgets", function(checked) {
env.editor.setFadeFoldWidgets(checked);
});
+bindCheckbox("read_only", function(checked) {
+ env.editor.setReadOnly(checked);
+});
var secondSession = null;
bindDropdown("split", function(value) {
diff --git a/demo/kitchen-sink/doclist.js b/demo/kitchen-sink/doclist.js
index 3ddbd0c5..f75e6e86 100644
--- a/demo/kitchen-sink/doclist.js
+++ b/demo/kitchen-sink/doclist.js
@@ -67,7 +67,7 @@ var docs = {
"docs/AsciiDoc.asciidoc": "AsciiDoc",
"docs/javascript.js": "JavaScript",
"docs/clojure.clj": "Clojure",
- "docs/coffeescript.coffee": "Coffeescript",
+ "docs/coffeescript.coffee": "CoffeeScript",
"docs/coldfusion.cfm": "ColdFusion",
"docs/cpp.cpp": "C/C++",
"docs/csharp.cs": "C#",
diff --git a/kitchen-sink.html b/kitchen-sink.html
index ce7d492f..c846e2aa 100644
--- a/kitchen-sink.html
+++ b/kitchen-sink.html
@@ -107,8 +107,10 @@
+
+
@@ -247,6 +249,14 @@
+
+ |
+
+ |
+
+
+ |
+
diff --git a/lib/ace/commands/default_commands.js b/lib/ace/commands/default_commands.js
index b8583c06..94f68d76 100644
--- a/lib/ace/commands/default_commands.js
+++ b/lib/ace/commands/default_commands.js
@@ -414,6 +414,16 @@ exports.commands = [{
bindKey: bindKey("Tab", "Tab"),
exec: function(editor) { editor.indent(); },
multiSelectAction: "forEach"
+},{
+ name: "blockoutdent",
+ bindKey: bindKey("Ctrl-[", "Ctrl-["),
+ exec: function(editor) { editor.blockOutdent(); },
+ multiSelectAction: "forEach"
+},{
+ name: "blockindent",
+ bindKey: bindKey("Ctrl-]", "Ctrl-]"),
+ exec: function(editor) { editor.blockIndent(); },
+ multiSelectAction: "forEach"
}, {
name: "insertstring",
exec: function(editor, str) { editor.insert(str); },
diff --git a/lib/ace/css/editor.css b/lib/ace/css/editor.css
index c4b40a4f..c1dd818a 100644
--- a/lib/ace/css/editor.css
+++ b/lib/ace/css/editor.css
@@ -7,6 +7,8 @@
.ace_scroller {
position: absolute;
overflow: hidden;
+ top: 0;
+ bottom: 0;
}
.ace_content {
@@ -20,8 +22,10 @@
.ace_gutter {
position: absolute;
overflow : hidden;
- height: 100%;
width: auto;
+ top: 0;
+ bottom: 0;
+ left: 0;
cursor: default;
z-index: 4;
}
@@ -66,6 +70,8 @@
overflow-x: hidden;
overflow-y: scroll;
right: 0;
+ top: 0;
+ bottom: 0;
}
.ace_scrollbar-inner {
@@ -241,13 +247,17 @@
}
.ace_gutter-tooltip {
- background-color: #FFFFD5;
+ background-color: #FFF;
+ background-image: -webkit-linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));
+ background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));
border: 1px solid gray;
- box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
+ border-radius: 1px;
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
color: black;
display: inline-block;
+ max-width: 500px;
padding: 4px;
- position: absolute;
+ position: fixed;
z-index: 300;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
@@ -255,6 +265,10 @@
cursor: default;
white-space: pre-line;
word-wrap: break-word;
+ line-height: normal;
+ font-style: normal;
+ font-weight: normal;
+ letter-spacing: normal;
}
.ace_folding-enabled > .ace_gutter-cell {
diff --git a/lib/ace/editor.js b/lib/ace/editor.js
index 5b5552d9..f85debf6 100644
--- a/lib/ace/editor.js
+++ b/lib/ace/editor.js
@@ -1015,6 +1015,8 @@ var Editor = function(renderer, session) {
**/
this.setReadOnly = function(readOnly) {
this.$readOnly = readOnly;
+ this.textInput.setReadOnly(readOnly);
+ this.renderer.$cursorLayer.setBlinking(!readOnly);
};
/**
@@ -1245,8 +1247,8 @@ var Editor = function(renderer, session) {
this.selection.setSelectionRange(originalRange);
};
- /**
- * Indents the current line.
+ /**
+ * Inserts an indentation into the current cursor position or indents the selected lines.
*
* @related EditSession.indentRows
**/
@@ -1273,7 +1275,16 @@ var Editor = function(renderer, session) {
}
};
- /**
+ /**
+ * Indents the current line.
+ * @related EditSession.indentRows
+ **/
+ this.blockIndent = function() {
+ var rows = this.$getSelectedRows();
+ this.session.indentRows(rows.first, rows.last, "\t");
+ };
+
+ /**
* Outdents the current line.
* @related EditSession.outdentRows
**/
diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js
index 3321f2b9..183260c9 100644
--- a/lib/ace/keyboard/textinput.js
+++ b/lib/ace/keyboard/textinput.js
@@ -355,11 +355,14 @@ var TextInput = function(parentNode, host) {
event.addListener(text, "keyup", onCompositionUpdate);
event.addListener(text, "compositionend", onCompositionEnd);
- // CONTEXTMENU
this.getElement = function() {
return text;
};
+ this.setReadOnly = function(readOnly) {
+ text.readOnly = readOnly;
+ };
+
this.onContextMenu = function(e) {
if (!tempStyle)
tempStyle = text.style.cssText;
diff --git a/lib/ace/mode/_test/tokens_php.json b/lib/ace/mode/_test/tokens_php.json
index ce7ce4b4..d8a41eec 100644
--- a/lib/ace/mode/_test/tokens_php.json
+++ b/lib/ace/mode/_test/tokens_php.json
@@ -8,25 +8,25 @@
["keyword","function"],
["text"," "],
["identifier","nfact"],
- ["lparen","("],
+ ["paren.lparen","("],
["variable","$n"],
- ["rparen",")"],
+ ["paren.rparen",")"],
["text"," "],
- ["lparen","{"]
+ ["paren.lparen","{"]
],[
"php-start",
["text"," "],
["keyword","if"],
["text"," "],
- ["lparen","("],
+ ["paren.lparen","("],
["variable","$n"],
["text"," "],
["keyword.operator","=="],
["text"," "],
["constant.numeric","0"],
- ["rparen",")"],
+ ["paren.rparen",")"],
["text"," "],
- ["lparen","{"]
+ ["paren.lparen","{"]
],[
"php-start",
["text"," "],
@@ -37,13 +37,13 @@
],[
"php-start",
["text"," "],
- ["rparen","}"]
+ ["paren.rparen","}"]
],[
"php-start",
["text"," "],
["keyword","else"],
["text"," "],
- ["lparen","{"]
+ ["paren.lparen","{"]
],[
"php-start",
["text"," "],
@@ -54,21 +54,21 @@
["keyword.operator","*"],
["text"," "],
["identifier","nfact"],
- ["lparen","("],
+ ["paren.lparen","("],
["variable","$n"],
["text"," "],
["keyword.operator","-"],
["text"," "],
["constant.numeric","1"],
- ["rparen",")"],
+ ["paren.rparen",")"],
["text",";"]
],[
"php-start",
["text"," "],
- ["rparen","}"]
+ ["paren.rparen","}"]
],[
"php-start",
- ["rparen","}"]
+ ["paren.rparen","}"]
],[
"php-start"
],[
@@ -86,11 +86,11 @@
["keyword.operator","="],
["text"," "],
["support.function","trim"],
- ["lparen","("],
+ ["paren.lparen","("],
["support.function","fgets"],
- ["lparen","("],
+ ["paren.lparen","("],
["constant.language","STDIN"],
- ["rparen","))"],
+ ["paren.rparen","))"],
["text",";"]
],[
"php-start"
@@ -112,9 +112,9 @@
["string","\" = \""],
["text"," . "],
["identifier","nfact"],
- ["lparen","("],
+ ["paren.lparen","("],
["variable","$num"],
- ["rparen",")"],
+ ["paren.rparen",")"],
["text"," . "],
["string","\""],
["constant.language.escape","\\n\\n"],
diff --git a/lib/ace/mode/behaviour/cstyle.js b/lib/ace/mode/behaviour/cstyle.js
index ccacd7ad..54f75526 100644
--- a/lib/ace/mode/behaviour/cstyle.js
+++ b/lib/ace/mode/behaviour/cstyle.js
@@ -350,7 +350,7 @@ var CstyleBehaviour = function () {
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
var line = session.doc.getLine(range.start.row);
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
- if (rightChar == '"') {
+ if (rightChar == selected) {
range.end.column++;
return range;
}
diff --git a/lib/ace/mode/php_highlight_rules.js b/lib/ace/mode/php_highlight_rules.js
index eac9ecea..299a16b1 100644
--- a/lib/ace/mode/php_highlight_rules.js
+++ b/lib/ace/mode/php_highlight_rules.js
@@ -978,10 +978,10 @@ var PhpLangHighlightRules = function() {
token : "keyword.operator",
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
}, {
- token : "lparen",
+ token : "paren.lparen",
regex : "[[({]"
}, {
- token : "rparen",
+ token : "paren.rparen",
regex : "[\\])}]"
}, {
token : "text",
diff --git a/lib/ace/mouse/default_gutter_handler.js b/lib/ace/mouse/default_gutter_handler.js
index 90d9747c..ee8f03af 100644
--- a/lib/ace/mouse/default_gutter_handler.js
+++ b/lib/ace/mouse/default_gutter_handler.js
@@ -66,7 +66,6 @@ function GutterHandler(mouseHandler) {
function createTooltip() {
tooltip = dom.createElement("div");
tooltip.className = "ace_gutter-tooltip";
- tooltip.style.maxWidth = "500px";
tooltip.style.display = "none";
editor.container.appendChild(tooltip);
}
@@ -111,10 +110,10 @@ function GutterHandler(mouseHandler) {
function moveTooltip(e) {
var rect = editor.renderer.$gutter.getBoundingClientRect();
- tooltip.style.left = e.x - rect.left + 15 + "px";
+ tooltip.style.left = e.x + 15 + "px";
if (e.y + 3 * editor.renderer.lineHeight + 15 < rect.bottom) {
tooltip.style.bottom = "";
- tooltip.style.top = e.y - rect.top + 15 + "px";
+ tooltip.style.top = e.y + 15 + "px";
} else {
tooltip.style.top = "";
tooltip.style.bottom = rect.bottom - e.y + 5 + "px";
diff --git a/lib/ace/mouse/dragdrop.js b/lib/ace/mouse/dragdrop.js
index 9f6c0c15..88f526b5 100644
--- a/lib/ace/mouse/dragdrop.js
+++ b/lib/ace/mouse/dragdrop.js
@@ -41,6 +41,8 @@ var DragdropHandler = function(mouseHandler) {
var mouseTarget = editor.container;
event.addListener(mouseTarget, "dragenter", function(e) {
+ if (editor.getReadOnly())
+ return;
counter++;
if (!dragSelectionMarker) {
range = editor.getSelectionRange();
@@ -55,6 +57,8 @@ var DragdropHandler = function(mouseHandler) {
});
event.addListener(mouseTarget, "dragover", function(e) {
+ if (editor.getReadOnly())
+ return;
x = e.clientX;
y = e.clientY;
return event.preventDefault(e);
@@ -67,10 +71,11 @@ var DragdropHandler = function(mouseHandler) {
};
event.addListener(mouseTarget, "dragleave", function(e) {
+ if (editor.getReadOnly())
+ return;
counter--;
if (counter > 0)
return;
- console.log(e.type, counter,e.target);
clearInterval(timerId);
editor.session.removeMarker(dragSelectionMarker);
dragSelectionMarker = null;
@@ -79,7 +84,8 @@ var DragdropHandler = function(mouseHandler) {
});
event.addListener(mouseTarget, "drop", function(e) {
- console.log(e.type, counter,e.target);
+ if (editor.getReadOnly())
+ return;
counter = 0;
clearInterval(timerId);
editor.session.removeMarker(dragSelectionMarker);
diff --git a/lib/ace/theme/monokai.css b/lib/ace/theme/monokai.css
index 1d772e24..d93600d2 100644
--- a/lib/ace/theme/monokai.css
+++ b/lib/ace/theme/monokai.css
@@ -1,6 +1,6 @@
.ace-monokai .ace_gutter {
- background: #2f3129;
- color: #f1f1f1
+ background: #2F3129;
+ color: #8F908A
}
.ace-monokai .ace_print-margin {
@@ -56,7 +56,7 @@
}
.ace-monokai .ace_invisible {
- color: #49483E
+ color: #52524d
}
.ace-monokai .ace_entity.ace_name.ace_tag,
diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js
index 24d4bd06..75860d92 100644
--- a/lib/ace/virtual_renderer.js
+++ b/lib/ace/virtual_renderer.js
@@ -306,7 +306,6 @@ var VirtualRenderer = function(container, theme) {
if (height && (force || size.height != height)) {
size.height = height;
- this.scroller.style.height = height + "px";
size.scrollerHeight = this.scroller.clientHeight;
this.scrollBar.setHeight(size.scrollerHeight);