(options)
| 550 | |
| 551 | class CaretMode extends VisualMode { |
| 552 | init(options) { |
| 553 | if (options == null) { |
| 554 | options = {}; |
| 555 | } |
| 556 | super.init( |
| 557 | Object.assign(options, { name: "caret", indicator: "Caret mode", alterMethod: "move" }), |
| 558 | ); |
| 559 | |
| 560 | // Establish the initial caret. |
| 561 | switch (this.selection.type) { |
| 562 | case "None": |
| 563 | this.establishInitialSelectionAnchor(); |
| 564 | if (this.selection.type === "None") { |
| 565 | this.exit(); |
| 566 | HUD.show("Create a selection before entering visual mode.", 2500); |
| 567 | return; |
| 568 | } |
| 569 | break; |
| 570 | case "Range": |
| 571 | this.movement.collapseSelectionToAnchor(); |
| 572 | break; |
| 573 | } |
| 574 | |
| 575 | this.movement.extendByOneCharacter(forward); |
| 576 | return this.movement.scrollIntoView(); |
| 577 | } |
| 578 | |
| 579 | commandHandler(...args) { |
| 580 | this.movement.collapseSelectionToAnchor(); |
no test coverage detected