(
position: Position,
vimState: VimState,
count: number,
)
| 1822 | } |
| 1823 | |
| 1824 | public override async execActionWithCount( |
| 1825 | position: Position, |
| 1826 | vimState: VimState, |
| 1827 | count: number, |
| 1828 | ): Promise<Position | IMovement> { |
| 1829 | // % has a special mode that lets you use it to jump to a percentage of the file |
| 1830 | // However, some other bracket motions inherit from this so only do this behavior for % explicitly |
| 1831 | if (Object.getPrototypeOf(this) === MoveToMatchingBracket.prototype) { |
| 1832 | if (count === 0) { |
| 1833 | if (vimState.recordedState.operator) { |
| 1834 | return this.execActionForOperator(position, vimState); |
| 1835 | } else { |
| 1836 | return this.execAction(position, vimState); |
| 1837 | } |
| 1838 | } |
| 1839 | |
| 1840 | // Check to make sure this is a valid percentage |
| 1841 | if (count < 0 || count > 100) { |
| 1842 | return failedMovement(vimState); |
| 1843 | } |
| 1844 | |
| 1845 | // See `:help N%` |
| 1846 | const targetLine = Math.trunc((count * vimState.document.lineCount + 99) / 100) - 1; |
| 1847 | |
| 1848 | return position.with({ line: targetLine }).obeyStartOfLine(vimState.document); |
| 1849 | } else { |
| 1850 | return super.execActionWithCount(position, vimState, count); |
| 1851 | } |
| 1852 | } |
| 1853 | } |
| 1854 | |
| 1855 | export abstract class MoveInsideCharacter extends ExpandingSelection { |
nothing calls this directly
no test coverage detected