codemirror
Advanced tools
Comparing version 5.48.2 to 5.48.4
@@ -42,3 +42,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
elt.style.direction = cm.getOption("direction"); | ||
elt.className = "CodeMirror-placeholder"; | ||
elt.className = "CodeMirror-placeholder CodeMirror-line-like"; | ||
var placeHolder = cm.getOption("placeholder") | ||
@@ -45,0 +45,0 @@ if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder) |
@@ -54,4 +54,9 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var marks = cm.findMarks(Pos(line, 0), Pos(line + 1, 0)); | ||
for (var i = 0; i < marks.length; ++i) | ||
if (marks[i].__isFold && marks[i].find().from.line == line) return marks[i]; | ||
for (var i = 0; i < marks.length; ++i) { | ||
if (marks[i].__isFold) { | ||
var fromPos = marks[i].find(-1); | ||
if (fromPos && fromPos.line === line) | ||
return marks[i]; | ||
} | ||
} | ||
} | ||
@@ -104,3 +109,3 @@ | ||
if (folded) folded.clear(); | ||
else cm.foldCode(Pos(line, 0), opts.rangeFinder); | ||
else cm.foldCode(Pos(line, 0), opts); | ||
} | ||
@@ -107,0 +112,0 @@ |
@@ -12,3 +12,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
* Created: 05/17/2012 09:20:25 PM | ||
* Revision: none | ||
* Revision: 08/05/2019 AstLinux Project: Support block-comments | ||
* | ||
@@ -71,3 +71,22 @@ * Author: Stas Kobzar (stas@modulis.ca), | ||
// comment | ||
if (state.blockComment) { | ||
if (ch == "-" && stream.match("-;", true)) { | ||
state.blockComment = false; | ||
} else if (stream.skipTo("--;")) { | ||
stream.next(); | ||
stream.next(); | ||
stream.next(); | ||
state.blockComment = false; | ||
} else { | ||
stream.skipToEnd(); | ||
} | ||
return "comment"; | ||
} | ||
if(ch == ";") { | ||
if (stream.match("--", true)) { | ||
if (!stream.match("-", false)) { // Except ;--- is not a block comment | ||
state.blockComment = true; | ||
return "comment"; | ||
} | ||
} | ||
stream.skipToEnd(); | ||
@@ -129,2 +148,3 @@ return "comment"; | ||
return { | ||
blockComment: false, | ||
extenStart: false, | ||
@@ -193,3 +213,7 @@ extenSame: false, | ||
return null; | ||
} | ||
}, | ||
blockCommentStart: ";--", | ||
blockCommentEnd: "--;", | ||
lineComment: ";" | ||
}; | ||
@@ -196,0 +220,0 @@ }); |
@@ -81,2 +81,11 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
return state.tokenize(stream, state) | ||
}, | ||
token: function(stream, _, style) { | ||
if (style == "variable") { | ||
// Assume uppercase symbols are classes using variable-2 | ||
var isUpper = RegExp('^[_$]*[A-Z][a-zA-Z0-9_$]*$','g'); | ||
if (isUpper.test(stream.current())) { | ||
return 'variable-2'; | ||
} | ||
} | ||
} | ||
@@ -83,0 +92,0 @@ } |
@@ -16,2 +16,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
start: [ | ||
{ regex: /\{\{\{/, push: "handlebars_raw", token: "tag" }, | ||
{ regex: /\{\{!--/, push: "dash_comment", token: "comment" }, | ||
@@ -21,2 +22,5 @@ { regex: /\{\{!/, push: "comment", token: "comment" }, | ||
], | ||
handlebars_raw: [ | ||
{ regex: /\}\}\}/, pop: true, token: "tag" }, | ||
], | ||
handlebars: [ | ||
@@ -23,0 +27,0 @@ { regex: /\}\}/, pop: true, token: "tag" }, |
@@ -190,11 +190,9 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
// Floats | ||
if (stream.match(/^\d*\.(?!\.)\d*([Eef][\+\-]?\d+)?/i)) { numberLiteral = true; } | ||
if (stream.match(/^\d+\.(?!\.)\d*/)) { numberLiteral = true; } | ||
if (stream.match(/^\.\d+/)) { numberLiteral = true; } | ||
if (stream.match(/^0x\.[0-9a-f]+p[\+\-]?\d+/i)) { numberLiteral = true; } | ||
if (stream.match(/^(?:(?:\d[_\d]*)?\.(?!\.)(?:\d[_\d]*)?|\d[_\d]*\.(?!\.)(?:\d[_\d]*))?([Eef][\+\-]?[_\d]+)?/i)) { numberLiteral = true; } | ||
if (stream.match(/^0x\.[0-9a-f_]+p[\+\-]?[_\d]+/i)) { numberLiteral = true; } | ||
// Integers | ||
if (stream.match(/^0x[0-9a-f]+/i)) { numberLiteral = true; } // Hex | ||
if (stream.match(/^0b[01]+/i)) { numberLiteral = true; } // Binary | ||
if (stream.match(/^0o[0-7]+/i)) { numberLiteral = true; } // Octal | ||
if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) { numberLiteral = true; } // Decimal | ||
if (stream.match(/^0x[0-9a-f_]+/i)) { numberLiteral = true; } // Hex | ||
if (stream.match(/^0b[01_]+/i)) { numberLiteral = true; } // Binary | ||
if (stream.match(/^0o[0-7_]+/i)) { numberLiteral = true; } // Octal | ||
if (stream.match(/^[1-9][_\d]*(e[\+\-]?\d+)?/)) { numberLiteral = true; } // Decimal | ||
// Zero by itself with no other piece of number. | ||
@@ -201,0 +199,0 @@ if (stream.match(/^0(?![\dx])/i)) { numberLiteral = true; } |
@@ -29,2 +29,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
"fallbackmsg": { noEndTag: true, reduceIndent: true}, | ||
"select": {}, | ||
"plural": {}, | ||
"let": { soyState: "var-def" }, | ||
@@ -31,0 +33,0 @@ "if": {}, |
{ | ||
"name": "codemirror", | ||
"version": "5.48.2", | ||
"version": "5.48.4", | ||
"main": "lib/codemirror.js", | ||
@@ -5,0 +5,0 @@ "style": "lib/codemirror.css", |
@@ -69,2 +69,2 @@ // EDITOR CONSTRUCTOR | ||
CodeMirror.version = "5.48.2" | ||
CodeMirror.version = "5.48.4" |
@@ -21,3 +21,3 @@ import { buildLineContent, LineView } from "../line/line_data.js" | ||
if (display.cachedPaddingH) return display.cachedPaddingH | ||
let e = removeChildrenAndAdd(display.measure, elt("pre", "x")) | ||
let e = removeChildrenAndAdd(display.measure, elt("pre", "x", "CodeMirror-line-like")) | ||
let style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle | ||
@@ -416,3 +416,3 @@ let data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)} | ||
pos.xRel = xRel | ||
if (outside) pos.outside = true | ||
if (outside) pos.outside = outside | ||
return pos | ||
@@ -426,6 +426,6 @@ } | ||
y += cm.display.viewOffset | ||
if (y < 0) return PosWithInfo(doc.first, 0, null, true, -1) | ||
if (y < 0) return PosWithInfo(doc.first, 0, null, -1, -1) | ||
let lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1 | ||
if (lineN > last) | ||
return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) | ||
return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) | ||
if (x < 0) x = 0 | ||
@@ -436,3 +436,3 @@ | ||
let found = coordsCharInner(cm, lineObj, lineN, x, y) | ||
let collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0)) | ||
let collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0)) | ||
if (!collapsed) return found | ||
@@ -525,3 +525,3 @@ let rangeEnd = collapsed.find(1) | ||
baseX = coords.left | ||
outside = y < coords.top || y >= coords.bottom | ||
outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0 | ||
} | ||
@@ -593,3 +593,3 @@ | ||
if (measureText == null) { | ||
measureText = elt("pre") | ||
measureText = elt("pre", null, "CodeMirror-line-like") | ||
// Measure a bunch of lines, for browsers that compute | ||
@@ -614,3 +614,3 @@ // fractional heights. | ||
let anchor = elt("span", "xxxxxxxxxx") | ||
let pre = elt("pre", [anchor]) | ||
let pre = elt("pre", [anchor], "CodeMirror-line-like") | ||
removeChildrenAndAdd(display.measure, pre) | ||
@@ -617,0 +617,0 @@ let rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10 |
@@ -18,3 +18,3 @@ import { retreatFrontier } from "../line/highlight.js" | ||
import { Range, Selection } from "./selection.js" | ||
import { setSelection, setSelectionNoUndo } from "./selection_updates.js" | ||
import { setSelection, setSelectionNoUndo, skipAtomic } from "./selection_updates.js" | ||
@@ -206,2 +206,5 @@ // UPDATING | ||
setSelectionNoUndo(doc, selAfter, sel_dontScroll) | ||
if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0))) | ||
doc.cantEdit = false | ||
} | ||
@@ -208,0 +211,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2802739
63256