(prevLineKeys: number[], lineKeys: number[])
| 144 | } |
| 145 | |
| 146 | function getDefaultFocus(prevLineKeys: number[], lineKeys: number[]) { |
| 147 | const focus = {} as Record<number, true>; |
| 148 | lineKeys.forEach((lineKey, lineIndex) => { |
| 149 | if (!prevLineKeys.includes(lineKey)) { |
| 150 | focus[lineIndex] = true; |
| 151 | } |
| 152 | }); |
| 153 | |
| 154 | if (Object.keys(focus).length === 0) { |
| 155 | lineKeys.forEach((_, lineIndex) => { |
| 156 | focus[lineIndex] = true; |
| 157 | }); |
| 158 | } |
| 159 | |
| 160 | return focus; |
| 161 | } |
| 162 | |
| 163 | function getLongestLineIndex(code: string) { |
| 164 | const newlineRe = /\r\n|\r|\n/; |