 _getPosition = (index) ->
   [line, lineOffset] = @doc.findLineAt(index)
   [leaf, leafOffset] = line.findLeafAt(lineOffset)
+  unless leaf?
+    leaf = line.leaves.first
+    leafOffset = 0
   node = leaf.node
-  node = node.firstChild if node.firstChild?
+  if DOM.isTextNode(node.firstChild)
+    node = node.firstChild
+  else if node.tagName == DOM.DEFAULT_BREAK_TAG
+    node = node.parentNode
+    leafOffset = node.childNodes.length - 1   # Set right before break tag
   return [node, leafOffset]
 
 

    selection = @document.getSelection()
    selection.removeAllRanges()
    if startNode?
      nativeRange = @document.createRange()
      nativeRange.setStart(startNode, startOffset)
      nativeRange.setEnd(endNode, endOffset)

    line = line.prev
    lineOffset += line.length + 1
  leaf = line.findLeaf(node)
  leaf = line.leaves.first unless leaf?
  leafOffset = 0
  while leaf.prev?
    leaf = leaf.prev
