| 47 | }); |
| 48 | |
| 49 | function eachGroup(doc, fn) { |
| 50 | // Groups start at lines not beginning with a tab |
| 51 | const total = doc.lines; |
| 52 | let start = 1; |
| 53 | while (start <= total) { |
| 54 | const header = doc.line(start); |
| 55 | // If header starts with tab, advance until a non-tab header |
| 56 | if (header.text.startsWith("\t")) { |
| 57 | start++; |
| 58 | continue; |
| 59 | } |
| 60 | let end = start; |
| 61 | for (let i = start + 1; i <= total; i++) { |
| 62 | const line = doc.line(i); |
| 63 | if (!line.text.startsWith("\t")) break; |
| 64 | end = i; |
| 65 | } |
| 66 | fn({ start, end }); |
| 67 | start = end + 1; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | class ChevronWidget extends WidgetType { |
| 72 | constructor(collapsed) { |