       options = {autoscroll: false, preserveFolds: true}
       selection.setBufferRange(newRange, options)
 
+  getEolBufferPosition: (cursor) ->
+    cursor.getCurrentLineBufferRange().end
+
+  # Cursor motion wrapper
+  # -------------------------
   moveCursorUp: (cursor) ->
     unless @at('FirstScreenRow', cursor)
       cursor.moveUp()


class MoveLeft extends Motion
  @extend()
  isMovable: (cursor) ->
    not @at('BOL', cursor) or settings.get('wrapLeftRightMotion')

  moveCursor: (cursor) ->
    @countTimes =>
      if @isMovable(cursor)
        @unfoldAtCursorRow(cursor)
        cursor.moveLeft()

class MoveRight extends Motion
  @extend()

      wrapBeyondNewlines: allowWrap
      wrapAtSoftNewlines: true

  moveCursorLeft: (cursor, allowWrap=false) ->
    if not cursor.isAtBeginningOfLine() or allowWrap
      cursor.moveLeft()

  # Utils
  # -------------------------
  countTimes: (fn) ->
