From f782e59f76881e0d3123a9e438f9b23040ce613a Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 1 Aug 2013 23:29:53 +0400 Subject: [PATCH 1/5] update build --- build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build b/build index cf536740..995de31e 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit cf536740d866276b65cfd351610001c2a841e751 +Subproject commit 995de31e6513ddfd5e9f66b8216f5b316fcd2253 From d884b44d488ae89251119a3b78f42f40d5e648da Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 4 Aug 2013 13:58:50 +0400 Subject: [PATCH 2/5] better save in the demo --- demo/kitchen-sink/demo.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js index 7e88967e..4495b62d 100644 --- a/demo/kitchen-sink/demo.js +++ b/demo/kitchen-sink/demo.js @@ -199,7 +199,31 @@ var commands = env.editor.commands; commands.addCommand({ name: "save", bindKey: {win: "Ctrl-S", mac: "Command-S"}, - exec: function() {alert("Fake Save File");} + exec: function(arg) { + var session = env.editor.session; + name = session.name.match(/[^\/]+$/) + localStorage.setItem( + "saved_file:" + name, + session.getValue() + ); + env.editor.cmdLine.setValue("saved "+ name); + } +}); + +commands.addCommand({ + name: "load", + bindKey: {win: "Ctrl-O", mac: "Command-O"}, + exec: function(arg) { + var session = env.editor.session; + name = session.name.match(/[^\/]+$/) + var value = localStorage.getItem("saved_file:" + name); + if (typeof value == "string") { + session.setValue(value); + env.editor.cmdLine.setValue("loaded "+ name); + } else { + env.editor.cmdLine.setValue("no previuos value saved for "+ name); + } + } }); var keybindings = { From d2318e99a2ae59be70b3f547f8165d8de7b7621b Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 5 Aug 2013 18:51:44 +0400 Subject: [PATCH 3/5] add increase/decrease fontSize commands to the demo --- demo/kitchen-sink/demo.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js index 4495b62d..9e4fa985 100644 --- a/demo/kitchen-sink/demo.js +++ b/demo/kitchen-sink/demo.js @@ -177,6 +177,26 @@ env.editor.commands.addCommands([{ editor.showKeyboardShortcuts() }) } +}, { + name: "increaseFontSize", + bindKey: "Ctrl-+", + exec: function(editor) { + var size = parseInt(editor.getFontSize(), 10) || 12; + editor.setFontSize(size + 1); + } +}, { + name: "decreaseFontSize", + bindKey: "Ctrl+-", + exec: function(editor) { + var size = parseInt(editor.getFontSize(), 10) || 12; + editor.setFontSize(Math.max(size - 1 || 1)); + } +}, { + name: "resetFontSize", + bindKey: "Ctrl+0", + exec: function(editor) { + editor.setFontSize(12); + } }]); From 9bf8eac28cdce1fa2595df56ce06bd55baeb17d8 Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 9 Aug 2013 00:12:52 +0400 Subject: [PATCH 4/5] add persistent vscroll option to the demo --- demo/kitchen-sink/demo.js | 7 ++++++- kitchen-sink.html | 2 ++ lib/ace/editor.js | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js index 9e4fa985..1ace9cb0 100644 --- a/demo/kitchen-sink/demo.js +++ b/demo/kitchen-sink/demo.js @@ -291,6 +291,7 @@ var showGutterEl = document.getElementById("show_gutter"); var showPrintMarginEl = document.getElementById("show_print_margin"); var highlightSelectedWordE = document.getElementById("highlight_selected_word"); var showHScrollEl = document.getElementById("show_hscroll"); +var showVScrollEl = document.getElementById("show_vscroll"); var animateScrollEl = document.getElementById("animate_scroll"); var softTabEl = document.getElementById("soft_tab"); var behavioursEl = document.getElementById("enable_behaviours"); @@ -453,7 +454,11 @@ bindCheckbox("highlight_selected_word", function(checked) { }); bindCheckbox("show_hscroll", function(checked) { - env.editor.renderer.setHScrollBarAlwaysVisible(checked); + env.editor.setOption("hScrollBarAlwaysVisible", checked); +}); + +bindCheckbox("show_vscroll", function(checked) { + env.editor.setOption("vScrollBarAlwaysVisible", checked); }); bindCheckbox("animate_scroll", function(checked) { diff --git a/kitchen-sink.html b/kitchen-sink.html index 586b317e..74f36a71 100644 --- a/kitchen-sink.html +++ b/kitchen-sink.html @@ -188,6 +188,8 @@ + + diff --git a/lib/ace/editor.js b/lib/ace/editor.js index 6aa2b2cc..5c5eb262 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -2370,6 +2370,7 @@ config.defineOptions(Editor.prototype, "editor", { wrapBehavioursEnabled: {initialValue: true}, hScrollBarAlwaysVisible: "renderer", + vScrollBarAlwaysVisible: "renderer", highlightGutterLine: "renderer", animatedScroll: "renderer", showInvisibles: "renderer", From 54a28806341243c834c4dda338cc74145591b10c Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 11 Aug 2013 11:53:21 +0400 Subject: [PATCH 5/5] small cleanup --- api/document.html | 2 +- lib/ace/document.js | 4 ++-- lib/ace/virtual_renderer.js | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/api/document.html b/api/document.html index 611e3b82..f1fc2ff5 100644 --- a/api/document.html +++ b/api/document.html @@ -243,7 +243,7 @@
-

Returns all lines in the document as string array. Warning: The caller should not modify this array!

+

Returns all lines in the document as string array.

Returns all lines in the document as string array. Warning: The caller should not modify this array!

diff --git a/lib/ace/document.js b/lib/ace/document.js index 7d8ca1d4..479a76da 100644 --- a/lib/ace/document.js +++ b/lib/ace/document.js @@ -81,7 +81,7 @@ var Document = function(text) { }; /** - * Returns all the lines in the document as a single string, split by the new line character. + * Returns all the lines in the document as a single string, joined by the new line character. **/ this.getValue = function() { return this.getAllLines().join(this.getNewLineCharacter()); @@ -191,7 +191,7 @@ var Document = function(text) { }; /** - * Returns all lines in the document as string array. Warning: The caller should not modify this array! + * Returns all lines in the document as string array. **/ this.getAllLines = function() { return this.getLines(0, this.getLength()); diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js index ce7d4e00..44c66660 100644 --- a/lib/ace/virtual_renderer.js +++ b/lib/ace/virtual_renderer.js @@ -738,9 +738,10 @@ var VirtualRenderer = function(container, theme) { this.$changes |= changes; return; } - if (!this.$size.width) + if (!this.$size.width) { + this.$changes |= changes; return this.onResize(true); - + } // this.$logChanges(changes); this._signal("beforeRender");