(cm, n, precise)
| 1125 | } |
| 1126 | |
| 1127 | function getContextBefore(cm, n, precise) { |
| 1128 | var doc = cm.doc, display = cm.display; |
| 1129 | if (!doc.mode.startState) { return new Context(doc, true, n) } |
| 1130 | var start = findStartLine(cm, n, precise); |
| 1131 | var saved = start > doc.first && getLine(doc, start - 1).stateAfter; |
| 1132 | var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start); |
| 1133 | |
| 1134 | doc.iter(start, n, function (line) { |
| 1135 | processLine(cm, line.text, context); |
| 1136 | var pos = context.line; |
| 1137 | line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null; |
| 1138 | context.nextLine(); |
| 1139 | }); |
| 1140 | if (precise) { doc.modeFrontier = context.line; } |
| 1141 | return context |
| 1142 | } |
| 1143 | |
| 1144 | // Lightweight form of highlight -- proceed over this line and |
| 1145 | // update state, but don't save a style array. Used for lines that |
no test coverage detected