mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Implement d3w
NumericPrefix now has a .select() method that calls select multiple times on its operand. Editor.selectToPosition modified to extend existing selections, and only create a new one if needed. This allows repetition of a motion's select method to expand the selection.
This commit is contained in:
@@ -68,6 +68,16 @@ describe "VimMode", ->
|
||||
expect(editor.buffer.getText()).toBe "abefg"
|
||||
expect(editor.getCursor()).toEqual {column: 2, row: 0}
|
||||
|
||||
editor.buffer.setText("one two three four")
|
||||
editor.setCursor(column: 0, row: 0)
|
||||
|
||||
editor.trigger keydownEvent('d')
|
||||
editor.trigger keydownEvent('3')
|
||||
editor.trigger keydownEvent('w')
|
||||
|
||||
expect(editor.buffer.getText()).toBe "four"
|
||||
expect(editor.getCursor()).toEqual {column: 0, row: 0}
|
||||
|
||||
describe "basic motion bindings", ->
|
||||
beforeEach ->
|
||||
editor.buffer.setText("12345\nabcde\nABCDE")
|
||||
|
||||
@@ -59,8 +59,9 @@ class Editor extends Template
|
||||
@aceEditor.navigateTo(row, column)
|
||||
|
||||
selectToPosition: (position) ->
|
||||
{ row, column } = @getCursor()
|
||||
@aceEditor.selection.setSelectionAnchor(row, column)
|
||||
if @aceEditor.selection.isEmpty()
|
||||
{ row, column } = @getCursor()
|
||||
@aceEditor.selection.setSelectionAnchor(row, column)
|
||||
@aceEditor.moveCursorToPosition(position)
|
||||
|
||||
delete: ->
|
||||
|
||||
@@ -22,6 +22,9 @@ module.exports =
|
||||
execute: (editor) ->
|
||||
_.times @count, => @operatorToRepeat.execute(editor)
|
||||
|
||||
select: (editor) ->
|
||||
_.times @count, => @operatorToRepeat.select(editor)
|
||||
|
||||
Delete: class
|
||||
complete: null
|
||||
motion: null
|
||||
|
||||
Reference in New Issue
Block a user