Skip to content
This repository was archived by the owner on Apr 6, 2018. It is now read-only.
Closed
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
13 changes: 13 additions & 0 deletions lib/vim-mode.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ module.exports =
@disposables.add new Disposable =>
@vimStates.forEach (vimState) -> vimState.destroy()

# Protect against edge cases where after splitting a pane, input would be
# enabled in the original pane in command mode
@disposables.add atom.workspace.onDidAddPane =>
for paneItem in atom.workspace.getPaneItems()
vimState = @vimStatesByEditor.get(paneItem)
if vimState? and vimState.mode isnt 'insert'
vimState.editorElement.component.setInputEnabled(false)
@disposables.add atom.workspace.onDidDestroyPane =>
for paneItem in atom.workspace.getPaneItems()
vimState = @vimStatesByEditor.get(paneItem)
if vimState? and vimState.mode isnt 'insert'
vimState.editorElement.component.setInputEnabled(false)

deactivate: ->
@disposables.dispose()

Expand Down
16 changes: 16 additions & 0 deletions spec/operators-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,22 @@ describe "Operators", ->
expect(editor.getText()).toBe " abcde\n"
expect(editor.getCursorScreenPosition()).toEqual [0, 2]

it "doesn't insert a d when used with pane splits", ->
editor.setText("12345\nabcde\n\nABCDE")
editor.setCursorScreenPosition([1, 1])
atom.workspace.getActivePane().splitDown()

keydown('d')
keydown('d')
expect(editor.getText()).toBe "12345\n\nABCDE"

editor.setText("12345\nabcde\n\nABCDE")
editor.setCursorScreenPosition([1, 1])
atom.workspace.activatePreviousPane()
keydown('d')
keydown('d')
expect(editor.getText()).toBe "12345\n\nABCDE"

describe "undo behavior", ->
beforeEach ->
editor.setText("12345\nabcde\nABCDE\nQWERT")
Expand Down