()
| 351 | } |
| 352 | |
| 353 | up(): Cursor { |
| 354 | const { line, column } = this.getPosition() |
| 355 | if (line === 0) { |
| 356 | return this |
| 357 | } |
| 358 | |
| 359 | const prevLine = this.measuredText.getWrappedText()[line - 1] |
| 360 | if (prevLine === undefined) { |
| 361 | return this |
| 362 | } |
| 363 | |
| 364 | const prevLineDisplayWidth = stringWidth(prevLine) |
| 365 | if (column > prevLineDisplayWidth) { |
| 366 | const newOffset = this.getOffset({ |
| 367 | line: line - 1, |
| 368 | column: prevLineDisplayWidth, |
| 369 | }) |
| 370 | return new Cursor(this.measuredText, newOffset, 0) |
| 371 | } |
| 372 | |
| 373 | const newOffset = this.getOffset({ line: line - 1, column }) |
| 374 | return new Cursor(this.measuredText, newOffset, 0) |
| 375 | } |
| 376 | |
| 377 | down(): Cursor { |
| 378 | const { line, column } = this.getPosition() |
no test coverage detected