Failing test

This commit is contained in:
Ben Ogle
2014-09-02 17:29:05 -07:00
parent 3a85148f69
commit 851034c8d3
2 changed files with 7 additions and 1 deletions

View File

@@ -321,6 +321,11 @@ describe "Editor", ->
editor.moveLeft()
expect(editor.getCursorScreenPosition()).toEqual [1, 7]
it "moves the cursor by n columns to the left", ->
editor.setCursorScreenPosition([1, 8])
editor.moveLeft(4)
expect(editor.getCursorScreenPosition()).toEqual [1, 4]
describe "when the cursor is in the first column", ->
describe "when there is a previous line", ->
it "wraps to the end of the previous line", ->

View File

@@ -260,10 +260,11 @@ class Cursor extends Model
# Public: Moves the cursor left one screen column.
#
# * `columnCount` (optional) {Number} number of rows to move (default: 1)
# * `options` (optional) {Object} with the following keys:
# * `moveToEndOfSelection` if true, move to the left of the selection if a
# selection exists.
moveLeft: ({moveToEndOfSelection}={}) ->
moveLeft: (columnCount=1, {moveToEndOfSelection}={}) ->
range = @marker.getScreenRange()
if moveToEndOfSelection and not range.isEmpty()
@setScreenPosition(range.start)