(cm, n, precise)
| 250 | // smallest indentation, which tends to need the least context to |
| 251 | // parse correctly. |
| 252 | function findStartLine(cm, n, precise) { |
| 253 | let minindent, minline, doc = cm.doc |
| 254 | let lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100) |
| 255 | for (let search = n; search > lim; --search) { |
| 256 | if (search <= doc.first) return doc.first |
| 257 | let line = getLine(doc, search - 1), after = line.stateAfter |
| 258 | if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier)) |
| 259 | return search |
| 260 | let indented = countColumn(line.text, null, cm.options.tabSize) |
| 261 | if (minline == null || minindent > indented) { |
| 262 | minline = search - 1 |
| 263 | minindent = indented |
| 264 | } |
| 265 | } |
| 266 | return minline |
| 267 | } |
| 268 | |
| 269 | export function retreatFrontier(doc, n) { |
| 270 | doc.modeFrontier = Math.min(doc.modeFrontier, n) |
no test coverage detected