mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Merge branch 'master' of github.com:github/atom
This commit is contained in:
@@ -138,6 +138,27 @@ describe "VimMode", ->
|
||||
expect(editor.buffer.getText()).toBe "four"
|
||||
expect(editor.getCursorPosition()).toEqual([0,0])
|
||||
|
||||
describe "when followed by a b", ->
|
||||
it "deletes to the beginning of the previous word", ->
|
||||
editor.buffer.setText("abcd efg")
|
||||
editor.setCursorPosition([0,2])
|
||||
|
||||
editor.trigger keydownEvent('d')
|
||||
editor.trigger keydownEvent('b')
|
||||
|
||||
expect(editor.buffer.getText()).toBe "cd efg"
|
||||
expect(editor.getCursorPosition()).toEqual([0,0])
|
||||
|
||||
# editor.buffer.setText("one two three four")
|
||||
# editor.setCursorPosition([0,11])
|
||||
|
||||
# editor.trigger keydownEvent('d')
|
||||
# editor.trigger keydownEvent('3')
|
||||
# editor.trigger keydownEvent('b')
|
||||
|
||||
# expect(editor.buffer.getText()).toBe "ee four"
|
||||
# expect(editor.getCursorPosition()).toEqual([0,0])
|
||||
|
||||
describe "basic motion bindings", ->
|
||||
beforeEach ->
|
||||
editor.buffer.setText("12345\nabcde\nABCDE")
|
||||
|
||||
@@ -88,7 +88,7 @@ class Cursor extends View
|
||||
|
||||
@setPosition({row, column})
|
||||
|
||||
moveLeftWhile: (regex) ->
|
||||
moveLeftUntilMatch: (regex) ->
|
||||
row = @getRow()
|
||||
column = @getColumn()
|
||||
offset = 0
|
||||
|
||||
@@ -132,6 +132,10 @@ class Selection extends View
|
||||
@modifySelection =>
|
||||
@cursor.moveDown()
|
||||
|
||||
selectLeftUntilMatch: (regex) ->
|
||||
@modifySelection =>
|
||||
@cursor.moveLeftUntilMatch(regex)
|
||||
|
||||
selectToPosition: (position) ->
|
||||
@modifySelection =>
|
||||
@cursor.setPosition(position)
|
||||
|
||||
@@ -31,7 +31,10 @@ class MoveDown extends Motion
|
||||
|
||||
class MoveToPreviousWord extends Motion
|
||||
execute: ->
|
||||
@editor.cursor.moveLeftWhile /^\s*(\w+|[^A-Za-z0-9_ ]+)/g
|
||||
@editor.getCursor().moveLeftUntilMatch /^\s*(\w+|[^A-Za-z0-9_ ]+)/
|
||||
|
||||
select: ->
|
||||
@editor.getSelection().selectLeftUntilMatch /^\s*(\w+|[^A-Za-z0-9_ ]+)/
|
||||
|
||||
class MoveToNextWord extends Motion
|
||||
execute: ->
|
||||
|
||||
Reference in New Issue
Block a user