Fix behavior of commands like '4>' and '4<' #98
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previous Behavior:
Let's assume we have a code block, and we have selected the entire block:
Selecting the entire block and entering the command '>>' results in the output
Which is the same as vim. But if we select the original block and issue the command '3>', we see the result:
Wheras, the same command issued through vim would result in:
After doing a little investigating, I realized that "3>" calls the "vi_indent" command three times.
The first time, it indents the entire block of text and deselects it. Since the caret is only on the first line for the second and third time the "vi_indent" function is called, only the first line gets indented.
The real proper fix for this bug would be to not call "transform_selection_regions" until the last call of vi_indent but this seemed like a simpler hack.