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