       false
 
   selectionIsInCursorTarget: ->
-    @locationIsCursorTarget(@getLocationRange().start)
+    @editingAttachment or @locationIsCursorTarget(@getLocationRange().start)
 
   # Attachment editing
 

    locationRange = @document.locationRangeFromPosition(position)
    @setLocationRange(locationRange)

  # Selection

  setSelectionForLocationRange: ->
    @getSelectionManager().setLocationRange(arguments...)

  moveCursorInDirection: (direction) ->
    distance = if direction is "backward" then -1 else 1
    locationRange = @document.locationRangeFromPosition(@getPosition() + distance)
    @setSelectionForLocationRange(locationRange)

  expandSelectionInDirection: (direction) ->
    range = @getRange()
    if direction is "backward" then range[0]-- else range[1]++
    locationRange = @document.locationRangeFromRange(range)
    @setSelectionForLocationRange(locationRange)


    locationRange = @getLocationRange()

    if locationRange.isCollapsed()
      range = @getExpandedRangeInDirection(direction)
      locationRange = @document.locationRangeFromRange(range)

      if direction is "backward"
