Skip to content
This repository was archived by the owner on Apr 6, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/vim-state.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,8 @@ class VimState
@pushOperations(new Prefixes.Repeat(num))

reverseSelections: ->
reversed = not @editor.getLastSelection().isReversed()
for selection in @editor.getSelections()
reversed = not selection.isReversed()
selection.setBufferRange(selection.getBufferRange(), {reversed})

# Private: Figure out whether or not we are in a repeat sequence or we just
Expand Down
26 changes: 26 additions & 0 deletions spec/vim-state-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,32 @@ describe "VimState", ->
[0, 8]
])

it "harmonizes selection directions", ->
keydown("i")
keydown("w")
editor.addCursorAtBufferPosition([0, Infinity])
keydown("h")

expect(editor.getSelectedBufferRanges()).toEqual([
[[0, 4], [0, 6]],
[[0, 12], [0, 13]]
])
expect(editor.getCursorBufferPositions()).toEqual([
[0, 6]
[0, 12]
])

keydown("o")

expect(editor.getSelectedBufferRanges()).toEqual([
[[0, 4], [0, 6]],
[[0, 12], [0, 13]]
])
expect(editor.getCursorBufferPositions()).toEqual([
[0, 6]
[0, 13]
])

describe "activate visualmode witin visualmode", ->
beforeEach ->
keydown('escape')
Expand Down