 class MoveToEndOfWord extends Motion
   execute: (count=1) ->
     cursor = @editor.getCursor()
-    _.map [1..count], =>
+    _.times count, =>
       cursor.setBufferPosition(@nextBufferPosition(exclusive: true))
 
   select: (count=1) ->
     cursor = @editor.getCursor()
 
-    _.map [1..count], =>
+    _.times count, =>
       bufferPosition = @nextBufferPosition()
       screenPosition = @editor.screenPositionForBufferPosition(bufferPosition)
       @editor.selectToScreenPosition(screenPosition)


class MoveToBeginningOfLine extends Motion
  execute: (count=1) ->
    _.map [1..count], =>
      @editor.moveCursorToBeginningOfLine()

  select: (count=1) ->
    _.map [1..count], =>
      @editor.selectToBeginningOfLine()
      true

class MoveToFirstCharacterOfLine extends Motion
  execute: (count=1) ->
    _.map [1..count], =>
      @editor.moveCursorToFirstCharacterOfLine()

  select: (count=1) ->
    _.map [1..count], =>
      @editor.selectToFirstCharacterOfLine()
      true

class MoveToLastCharacterOfLine extends Motion
  execute: (count=1) ->
    _.map [1..count], =>
      @editor.moveCursorToEndOfLine()

  select: (count=1) ->
    _.map [1..count], =>
      @editor.selectToEndOfLine()
      true



class MoveLeft extends Motion
  execute: (count=1) ->
    _.times count, =>
      {row, column} = @editor.getCursorScreenPosition()
      @editor.moveCursorLeft() if column > 0

  select: (count=1) ->
    _.times count, =>
      {row, column} = @editor.getCursorScreenPosition()

      if column > 0
