(position: Position, vimState: VimState)
| 520 | keys = ['i', 'p']; |
| 521 | |
| 522 | public async execAction(position: Position, vimState: VimState): Promise<IMovement> { |
| 523 | vimState.currentRegisterMode = RegisterMode.LineWise; |
| 524 | |
| 525 | let start: Position; |
| 526 | let stop: Position; |
| 527 | |
| 528 | if (vimState.document.lineAt(position).isEmptyOrWhitespace) { |
| 529 | // The cursor is at an empty line, so white lines are the paragraph. |
| 530 | start = position.getLineBegin(); |
| 531 | stop = position.getLineEnd(); |
| 532 | while (start.line > 0 && vimState.document.lineAt(start.getUp()).isEmptyOrWhitespace) { |
| 533 | start = start.getUp(); |
| 534 | } |
| 535 | while ( |
| 536 | stop.line < vimState.document.lineCount - 1 && |
| 537 | vimState.document.lineAt(stop.getDown()).isEmptyOrWhitespace |
| 538 | ) { |
| 539 | stop = stop.with({ character: 0 }).getDown(); |
| 540 | } |
| 541 | } else { |
| 542 | const currentParagraphBegin = getCurrentParagraphBeginning(position, true); |
| 543 | stop = getCurrentParagraphEnd(position, true); |
| 544 | if (vimState.document.lineAt(currentParagraphBegin).isEmptyOrWhitespace) { |
| 545 | start = currentParagraphBegin.getRightThroughLineBreaks(); |
| 546 | } else { |
| 547 | start = currentParagraphBegin; |
| 548 | } |
| 549 | |
| 550 | // Exclude additional blank lines. |
| 551 | while (stop.line > 0 && vimState.document.lineAt(stop).isEmptyOrWhitespace) { |
| 552 | stop = stop.getUp().getLineEnd(); |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | return { |
| 557 | start, |
| 558 | stop, |
| 559 | }; |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | @RegisterAction |
nothing calls this directly
no test coverage detected