codemirror
Advanced tools
Comparing version 5.43.0 to 5.44.0
@@ -23,3 +23,13 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var pos = ranges[i].head; | ||
// If we're not in Markdown mode, fall back to normal newlineAndIndent | ||
var eolState = cm.getStateAfter(pos.line); | ||
var inner = cm.getMode().innerMode(eolState); | ||
if (inner.mode.name !== "markdown") { | ||
cm.execCommand("newlineAndIndent"); | ||
return; | ||
} else { | ||
eolState = inner.state; | ||
} | ||
var inList = eolState.list !== false; | ||
@@ -26,0 +36,0 @@ var inQuote = eolState.quote !== 0; |
// CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
// Distributed under an MIT license: https://codemirror.net/LICENSE | ||
var mac = /Mac/.test(navigator.platform); | ||
(function(mod) { | ||
@@ -173,2 +171,4 @@ if (typeof exports == "object" && typeof module == "object") // CommonJS | ||
var mac = /Mac/.test(navigator.platform); | ||
if (mac) { | ||
@@ -175,0 +175,0 @@ baseMap["Ctrl-P"] = function() {handle.moveFocus(-1);}; |
@@ -602,2 +602,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
} | ||
if (value == "|" || value == "&") return cont(typeexpr) | ||
if (type == "string" || type == "number" || type == "atom") return cont(afterType); | ||
@@ -684,22 +685,15 @@ if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType) | ||
if (value == "await") return cont(forspec); | ||
if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex); | ||
if (type == "(") return cont(pushlex(")"), forspec1, poplex); | ||
} | ||
function forspec1(type) { | ||
if (type == "var") return cont(vardef, expect(";"), forspec2); | ||
if (type == ";") return cont(forspec2); | ||
if (type == "variable") return cont(formaybeinof); | ||
return pass(expression, expect(";"), forspec2); | ||
if (type == "var") return cont(vardef, forspec2); | ||
if (type == "variable") return cont(forspec2); | ||
return pass(forspec2) | ||
} | ||
function formaybeinof(_type, value) { | ||
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); } | ||
return cont(maybeoperatorComma, forspec2); | ||
} | ||
function forspec2(type, value) { | ||
if (type == ";") return cont(forspec3); | ||
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); } | ||
return pass(expression, expect(";"), forspec3); | ||
if (type == ")") return cont() | ||
if (type == ";") return cont(forspec2) | ||
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression, forspec2) } | ||
return pass(expression, forspec2) | ||
} | ||
function forspec3(type) { | ||
if (type != ")") cont(expression); | ||
} | ||
function functiondef(type, value) { | ||
@@ -729,2 +723,3 @@ if (value == "*") {cx.marked = "keyword"; return cont(functiondef);} | ||
if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(funarg); } | ||
if (isTS && type == "this") return cont(maybetype, maybeAssign) | ||
return pass(pattern, maybetype, maybeAssign); | ||
@@ -731,0 +726,0 @@ } |
@@ -26,35 +26,35 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var operators = parserConf.operators || wordRegexp([ | ||
"[<>]:", "[<>=]=", "<<=?", ">>>?=?", "=>", "->", "\\/\\/", | ||
"[\\\\%*+\\-<>!=\\/^|&\\u00F7\\u22BB]=?", "\\?", "\\$", "~", ":", | ||
"\\u00D7", "\\u2208", "\\u2209", "\\u220B", "\\u220C", "\\u2218", | ||
"\\u221A", "\\u221B", "\\u2229", "\\u222A", "\\u2260", "\\u2264", | ||
"\\u2265", "\\u2286", "\\u2288", "\\u228A", "\\u22C5", | ||
"\\b(in|isa)\\b(?!\.?\\()"], ""); | ||
"[<>]:", "[<>=]=", "<<=?", ">>>?=?", "=>", "->", "\\/\\/", | ||
"[\\\\%*+\\-<>!=\\/^|&\\u00F7\\u22BB]=?", "\\?", "\\$", "~", ":", | ||
"\\u00D7", "\\u2208", "\\u2209", "\\u220B", "\\u220C", "\\u2218", | ||
"\\u221A", "\\u221B", "\\u2229", "\\u222A", "\\u2260", "\\u2264", | ||
"\\u2265", "\\u2286", "\\u2288", "\\u228A", "\\u22C5", | ||
"\\b(in|isa)\\b(?!\.?\\()"], ""); | ||
var delimiters = parserConf.delimiters || /^[;,()[\]{}]/; | ||
var identifiers = parserConf.identifiers || | ||
/^[_A-Za-z\u00A1-\u2217\u2219-\uFFFF][\w\u00A1-\u2217\u2219-\uFFFF]*!*/; | ||
/^[_A-Za-z\u00A1-\u2217\u2219-\uFFFF][\w\u00A1-\u2217\u2219-\uFFFF]*!*/; | ||
var chars = wordRegexp([octChar, hexChar, sChar, uChar], "'"); | ||
var commonOpeners = ["begin", "function", "type", "struct", "immutable", | ||
"let", "macro", "for", "while", "quote", "if", "else", "elseif", "try", | ||
"finally", "catch", "do"]; | ||
var openersList = ["begin", "function", "type", "struct", "immutable", "let", | ||
"macro", "for", "while", "quote", "if", "else", "elseif", "try", | ||
"finally", "catch", "do"]; | ||
var commonClosers = ["end", "else", "elseif", "catch", "finally"]; | ||
var closersList = ["end", "else", "elseif", "catch", "finally"]; | ||
var commonKeywords = ["if", "else", "elseif", "while", "for", "begin", | ||
"let", "end", "do", "try", "catch", "finally", "return", "break", | ||
"continue", "global", "local", "const", "export", "import", "importall", | ||
"using", "function", "where", "macro", "module", "baremodule", "struct", | ||
"type", "mutable", "immutable", "quote", "typealias", "abstract", | ||
"primitive", "bitstype"]; | ||
var keywordsList = ["if", "else", "elseif", "while", "for", "begin", "let", | ||
"end", "do", "try", "catch", "finally", "return", "break", "continue", | ||
"global", "local", "const", "export", "import", "importall", "using", | ||
"function", "where", "macro", "module", "baremodule", "struct", "type", | ||
"mutable", "immutable", "quote", "typealias", "abstract", "primitive", | ||
"bitstype"]; | ||
var commonBuiltins = ["true", "false", "nothing", "NaN", "Inf"]; | ||
var builtinsList = ["true", "false", "nothing", "NaN", "Inf"]; | ||
CodeMirror.registerHelper("hintWords", "julia", commonKeywords.concat(commonBuiltins)); | ||
CodeMirror.registerHelper("hintWords", "julia", keywordsList.concat(builtinsList)); | ||
var openers = wordRegexp(commonOpeners); | ||
var closers = wordRegexp(commonClosers); | ||
var keywords = wordRegexp(commonKeywords); | ||
var builtins = wordRegexp(commonBuiltins); | ||
var openers = wordRegexp(openersList); | ||
var closers = wordRegexp(closersList); | ||
var keywords = wordRegexp(keywordsList); | ||
var builtins = wordRegexp(builtinsList); | ||
@@ -66,15 +66,7 @@ var macro = /^@[_A-Za-z][\w]*/; | ||
function inArray(state) { | ||
return inGenerator(state, '[') | ||
return (state.nestedArrays > 0); | ||
} | ||
function inGenerator(state, bracket, depth) { | ||
if (typeof(bracket) === "undefined") { bracket = '('; } | ||
if (typeof(depth) === "undefined") { depth = 0; } | ||
var scope = currentScope(state, depth); | ||
if ((depth == 0 && scope === "if" && inGenerator(state, bracket, depth + 1)) || | ||
(scope === "for" && inGenerator(state, bracket, depth + 1)) || | ||
(scope === bracket)) { | ||
return true; | ||
} | ||
return false; | ||
function inGenerator(state) { | ||
return (state.nestedGenerators > 0); | ||
} | ||
@@ -131,2 +123,3 @@ | ||
state.scopes.push('['); | ||
state.nestedArrays++; | ||
} | ||
@@ -136,2 +129,3 @@ | ||
state.scopes.push('('); | ||
state.nestedGenerators++; | ||
} | ||
@@ -143,2 +137,3 @@ | ||
state.scopes.pop(); | ||
state.nestedArrays--; | ||
state.leavingExpr = true; | ||
@@ -151,2 +146,3 @@ } | ||
state.scopes.pop(); | ||
state.nestedGenerators--; | ||
state.leavingExpr = true; | ||
@@ -165,10 +161,8 @@ } | ||
var match; | ||
if (match = stream.match(openers)) { | ||
if (match = stream.match(openers, false)) { | ||
state.scopes.push(match[0]); | ||
return "keyword"; | ||
} | ||
if (stream.match(closers)) { | ||
if (stream.match(closers, false)) { | ||
state.scopes.pop(); | ||
return "keyword"; | ||
} | ||
@@ -317,9 +311,9 @@ | ||
if (stream.match(/^{/)) { | ||
state.nestedLevels++; | ||
state.nestedParameters++; | ||
} else if (stream.match(/^}/)) { | ||
state.nestedLevels--; | ||
state.nestedParameters--; | ||
} | ||
if (state.nestedLevels > 0) { | ||
if (state.nestedParameters > 0) { | ||
stream.match(/.*?(?={|})/) || stream.next(); | ||
} else if (state.nestedLevels == 0) { | ||
} else if (state.nestedParameters == 0) { | ||
state.tokenize = tokenBase; | ||
@@ -332,3 +326,3 @@ } | ||
if (stream.match(/^#=/)) { | ||
state.nestedLevels++; | ||
state.nestedComments++; | ||
} | ||
@@ -339,4 +333,4 @@ if (!stream.match(/.*?(?=(#=|=#))/)) { | ||
if (stream.match(/^=#/)) { | ||
state.nestedLevels--; | ||
if (state.nestedLevels == 0) | ||
state.nestedComments--; | ||
if (state.nestedComments == 0) | ||
state.tokenize = tokenBase; | ||
@@ -404,3 +398,6 @@ } | ||
isDefinition: false, | ||
nestedLevels: 0, | ||
nestedArrays: 0, | ||
nestedComments: 0, | ||
nestedGenerators: 0, | ||
nestedParameters: 0, | ||
charsAdvanced: 0, | ||
@@ -407,0 +404,0 @@ firstParenPos: -1 |
@@ -16,3 +16,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
"else", "switch", "case", "default", "foreach", "ifempty", "for", | ||
"call", "param", "deltemplate", "delcall", "log"]; | ||
"call", "param", "deltemplate", "delcall", "log", "element"]; | ||
@@ -332,3 +332,3 @@ CodeMirror.defineMode("soy", function(config) { | ||
} | ||
} else if (state.tag.match(/^@(?:param\??|inject|prop)/)) { | ||
} else if (state.tag.match(/^@(?:param\??|inject|state)/)) { | ||
state.soyState.push("param-def"); | ||
@@ -335,0 +335,0 @@ } else if (state.tag.match(/^(?:param)/)) { |
{ | ||
"name": "codemirror", | ||
"version": "5.43.0", | ||
"version": "5.44.0", | ||
"main": "lib/codemirror.js", | ||
@@ -5,0 +5,0 @@ "style": "lib/codemirror.css", |
import { heightAtLine } from "../line/spans.js" | ||
import { getLine, lineAtHeight, updateLineHeight } from "../line/utils_line.js" | ||
import { paddingTop, textHeight, charWidth } from "../measurement/position_measurement.js" | ||
import { paddingTop, charWidth } from "../measurement/position_measurement.js" | ||
import { ie, ie_version } from "../util/browser.js" | ||
@@ -28,3 +28,2 @@ | ||
let diff = cur.line.height - height | ||
if (height < 2) height = textHeight(display) | ||
if (diff > .005 || diff < -.005) { | ||
@@ -31,0 +30,0 @@ updateLineHeight(cur.line, height) |
@@ -60,3 +60,3 @@ import { Display } from "../display/Display.js" | ||
suppressEdits: false, // used to disable editing during key handlers when in readOnly mode | ||
pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll | ||
pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll | ||
selectingText: false, | ||
@@ -63,0 +63,0 @@ draggingText: false, |
@@ -69,2 +69,2 @@ // EDITOR CONSTRUCTOR | ||
CodeMirror.version = "5.43.0" | ||
CodeMirror.version = "5.44.0" |
@@ -28,3 +28,4 @@ import { runInOp } from "../display/operations.js" | ||
let paste = cm.state.pasteIncoming || origin == "paste" | ||
let recent = +new Date - 200 | ||
let paste = origin == "paste" || cm.state.pasteIncoming > recent | ||
let textLines = splitLinesAuto(inserted), multiPaste = null | ||
@@ -58,3 +59,3 @@ // When pasting N lines into N selections, insert one line per selection | ||
let changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines, | ||
origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")} | ||
origin: origin || (paste ? "paste" : cm.state.cutIncoming > recent ? "cut" : "+input")} | ||
makeChange(cm.doc, changeEvent) | ||
@@ -69,3 +70,3 @@ signalLater(cm, "inputRead", cm, changeEvent) | ||
cm.curOp.typing = true | ||
cm.state.pasteIncoming = cm.state.cutIncoming = false | ||
cm.state.pasteIncoming = cm.state.cutIncoming = -1 | ||
} | ||
@@ -72,0 +73,0 @@ |
@@ -51,3 +51,3 @@ import { operation, runInOp } from "../display/operations.js" | ||
cm.state.pasteIncoming = true | ||
cm.state.pasteIncoming = +new Date | ||
input.fastPoll() | ||
@@ -73,3 +73,3 @@ }) | ||
} | ||
if (e.type == "cut") cm.state.cutIncoming = true | ||
if (e.type == "cut") cm.state.cutIncoming = +new Date | ||
} | ||
@@ -81,4 +81,12 @@ on(te, "cut", prepareCopyCut) | ||
if (eventInWidget(display, e) || signalDOMEvent(cm, e)) return | ||
cm.state.pasteIncoming = true | ||
input.focus() | ||
if (!te.dispatchEvent) { | ||
cm.state.pasteIncoming = +new Date | ||
input.focus() | ||
return | ||
} | ||
// Pass the `paste` event to the textarea so it's handled by its event listener. | ||
const event = new Event("paste") | ||
event.clipboardData = e.clipboardData | ||
te.dispatchEvent(event) | ||
}) | ||
@@ -85,0 +93,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 too big to display
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 not supported yet
2784508
324
62999