From f18a57126d7d138d6556ab8d8bac84d25351a4b9 Mon Sep 17 00:00:00 2001 From: Sawyer Hollenshead Date: Mon, 11 Nov 2013 17:09:52 -0500 Subject: [PATCH 1/3] Specify type of string (strong, emphasis, blockquote) --- lib/ace/mode/markdown_highlight_rules.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ace/mode/markdown_highlight_rules.js b/lib/ace/mode/markdown_highlight_rules.js index 4e07edff..5533fdbd 100644 --- a/lib/ace/mode/markdown_highlight_rules.js +++ b/lib/ace/mode/markdown_highlight_rules.js @@ -82,7 +82,7 @@ var MarkdownHighlightRules = function() { regex : "^```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$", next : "githubblock" }, { // block quote - token : "string", + token : "string.blockquote", regex : "^>[ ].+$", next : "blockquote" }, { // HR * - _ @@ -119,10 +119,10 @@ var MarkdownHighlightRules = function() { '(\\s*"' + escaped('"') + '"\\s*)?' + // "title" "(\\))" // ) }, { // strong ** __ - token : "string", + token : "string.strong", regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)" }, { // emphasis * _ - token : "string", + token : "string.emphasis", regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)" }, { // token : ["text", "url", "text"], From 188252891ae55122c3e1b8062e36bedaaa35507c Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 13 Nov 2013 03:22:22 +0400 Subject: [PATCH 2/3] update test --- lib/ace/mode/_test/tokens_markdown.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ace/mode/_test/tokens_markdown.json b/lib/ace/mode/_test/tokens_markdown.json index 3c0db62f..05804dca 100644 --- a/lib/ace/mode/_test/tokens_markdown.json +++ b/lib/ace/mode/_test/tokens_markdown.json @@ -88,9 +88,9 @@ "listblock", ["markup.list","* "], ["list","usually "], - ["string","*work*"], + ["string.emphasis","*work*"], ["list"," fine ("], - ["string","_em_"], + ["string.emphasis","_em_"], ["list",")"] ],[ "listblock", From 60cfe6f16102baa668ed7dae979dc275b659a5c9 Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 13 Nov 2013 03:34:52 +0400 Subject: [PATCH 3/3] update wrapData when wrapMethod changes --- lib/ace/edit_session.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js index 98c1e940..5f77bfd8 100644 --- a/lib/ace/edit_session.js +++ b/lib/ace/edit_session.js @@ -948,9 +948,9 @@ var EditSession = function(text, mode) { this.tokenRe = mode.tokenRe; this.nonTokenRe = mode.nonTokenRe; - this.$options.wrapMethod.set.call(this, this.$wrapMethod); if (!$isPlaceholder) { + this.$options.wrapMethod.set.call(this, this.$wrapMethod); this.$setFolding(mode.foldingRules); this._emit("changeMode"); this.bgTokenizer.start(0); @@ -2456,10 +2456,17 @@ config.defineOptions(EditSession.prototype, "session", { wrapMethod: { // code|text|auto set: function(val) { - if (val == "auto") - this.$wrapAsCode = this.$mode.type != "text"; - else - this.$wrapAsCode = val != "text"; + val = val == "auto" + ? this.$mode.type != "text" + : val != "text"; + if (val != this.$wrapAsCode) { + this.$wrapAsCode = val; + if (this.$useWrapMode) { + this.$modified = true; + this.$resetRowCache(0); + this.$updateWrapData(0, this.getLength() - 1); + } + } }, initialValue: "auto" },