(text, caret)
| 51 | }; |
| 52 | |
| 53 | const lineAt = (text, caret) => { |
| 54 | const start = text.lastIndexOf('\n', caret - 1) + 1; |
| 55 | const nl = text.indexOf('\n', caret); |
| 56 | const end = nl === -1 ? text.length : nl; |
| 57 | return { start, end, body: text.slice(start, end), col: caret - start }; |
| 58 | }; |
| 59 | const firstNonWS = (s) => { for (let i = 0; i < s.length; i++) if (!WS.test(s[i])) return i; return s.length; }; |
| 60 | |
| 61 | // `prevIndentTabStop`, distance to the previous tab stop from `col`. |
no outgoing calls
no test coverage detected