From 8313083cd9813614241d72036a49eddfb2ddfb3f Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 17 Dec 2013 20:48:19 +0000 Subject: [PATCH 1/3] better handling for attribute queries --- src/static/js/ace2_inner.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 0aa9998ad..b68b020ca 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -2334,7 +2334,10 @@ function Ace2Inner(){ return false; // If we're at the end of a line we treat it as having no formatting } if(rep.selStart[1] == 0 && rep.selEnd[1] == 0){ - return false; // If we're at the start of a line attributes get confused.. + rep.selEnd[1] == 1; + } + if(rep.selEnd[1] == -1){ + rep.selEnd[1] = 1; // sometimes rep.selEnd is -1, not sure why.. When it is we should look at the first char } if (n == selStartLine) { From 1a138438ebff98e3b93f0f1a9e8ded69735bee34 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 18 Dec 2013 18:34:35 +0000 Subject: [PATCH 2/3] dont error when pressing del on rep 0 0 --- src/static/js/ace2_inner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index b68b020ca..0866f6824 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -1668,7 +1668,7 @@ function Ace2Inner(){ { //var id = n.uniqueId(); // parent of n may not be "root" in IE due to non-tree-shaped DOM (wtf) - n.parentNode.removeChild(n); + if(n.parentNode) n.parentNode.removeChild(n); //dmesg(htmlPrettyEscape(htmlForRemovedChild(n))); //console.log("removed: "+id); From 333d2f119b4c19777f3b709f0548b25c03e2ba56 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 18 Dec 2013 22:13:03 +0000 Subject: [PATCH 3/3] expose update browser selection function --- src/static/js/ace2_inner.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 0866f6824..6c4d9b4f1 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -3954,6 +3954,7 @@ function Ace2Inner(){ selection.focusAtStart = !! rep.selFocusAtStart; setSelection(selection); } + editorInfo.ace_updateBrowserSelectionFromRep = updateBrowserSelectionFromRep; function nodeMaxIndex(nd) {