()
| 326 | } |
| 327 | |
| 328 | up(): Cursor { |
| 329 | const { line, column } = this.getPosition() |
| 330 | if (line === 0) { |
| 331 | return this |
| 332 | } |
| 333 | |
| 334 | const prevLine = this.measuredText.getWrappedText()[line - 1] |
| 335 | if (prevLine === undefined) { |
| 336 | return this |
| 337 | } |
| 338 | |
| 339 | const prevLineDisplayWidth = stringWidth(prevLine) |
| 340 | if (column > prevLineDisplayWidth) { |
| 341 | const newOffset = this.getOffset({ |
| 342 | line: line - 1, |
| 343 | column: prevLineDisplayWidth, |
| 344 | }) |
| 345 | return new Cursor(this.measuredText, newOffset, 0) |
| 346 | } |
| 347 | |
| 348 | const newOffset = this.getOffset({ line: line - 1, column }) |
| 349 | return new Cursor(this.measuredText, newOffset, 0) |
| 350 | } |
| 351 | |
| 352 | down(): Cursor { |
| 353 | const { line, column } = this.getPosition() |
no test coverage detected