Merge branch 'markdown_tweaks'

This commit is contained in:
nightwing 2013-11-13 03:36:07 +04:00
commit 90e7cdd7f1
3 changed files with 17 additions and 10 deletions

View file

@ -948,9 +948,9 @@ var EditSession = function(text, mode) {
this.tokenRe = mode.tokenRe; this.tokenRe = mode.tokenRe;
this.nonTokenRe = mode.nonTokenRe; this.nonTokenRe = mode.nonTokenRe;
this.$options.wrapMethod.set.call(this, this.$wrapMethod);
if (!$isPlaceholder) { if (!$isPlaceholder) {
this.$options.wrapMethod.set.call(this, this.$wrapMethod);
this.$setFolding(mode.foldingRules); this.$setFolding(mode.foldingRules);
this._emit("changeMode"); this._emit("changeMode");
this.bgTokenizer.start(0); this.bgTokenizer.start(0);
@ -2456,10 +2456,17 @@ config.defineOptions(EditSession.prototype, "session", {
wrapMethod: { wrapMethod: {
// code|text|auto // code|text|auto
set: function(val) { set: function(val) {
if (val == "auto") val = val == "auto"
this.$wrapAsCode = this.$mode.type != "text"; ? this.$mode.type != "text"
else : val != "text";
this.$wrapAsCode = 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" initialValue: "auto"
}, },

View file

@ -88,9 +88,9 @@
"listblock", "listblock",
["markup.list","* "], ["markup.list","* "],
["list","usually "], ["list","usually "],
["string","*work*"], ["string.emphasis","*work*"],
["list"," fine ("], ["list"," fine ("],
["string","_em_"], ["string.emphasis","_em_"],
["list",")"] ["list",")"]
],[ ],[
"listblock", "listblock",

View file

@ -82,7 +82,7 @@ var MarkdownHighlightRules = function() {
regex : "^```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$", regex : "^```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$",
next : "githubblock" next : "githubblock"
}, { // block quote }, { // block quote
token : "string", token : "string.blockquote",
regex : "^>[ ].+$", regex : "^>[ ].+$",
next : "blockquote" next : "blockquote"
}, { // HR * - _ }, { // HR * - _
@ -119,10 +119,10 @@ var MarkdownHighlightRules = function() {
'(\\s*"' + escaped('"') + '"\\s*)?' + // "title" '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
"(\\))" // ) "(\\))" // )
}, { // strong ** __ }, { // strong ** __
token : "string", token : "string.strong",
regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)" regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
}, { // emphasis * _ }, { // emphasis * _
token : "string", token : "string.emphasis",
regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)" regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
}, { // }, { //
token : ["text", "url", "text"], token : ["text", "url", "text"],