       @nativeSelection.setSingleRange(nativeRange)
     else
       @nativeSelection.removeAllRanges()
-    @editor.emit(Scribe.Editor.events.SELECTION_CHANGE, @range) unless silent
+    @editor.emit(Scribe.Editor.events.SELECTION_CHANGE, range) unless silent or range == @range or @range?.equals(range)
+    @range = range
 
   update: (silent = false) ->
-    range = this.getRange()
-    unless range == @range or @range?.equals(range)
-      @editor.emit(Scribe.Editor.events.SELECTION_CHANGE, range) unless silent
-      @range = range
+    nativeRange = normalizeNativeRange(this.getNativeRange())
+    unless compareRanges(nativeRange, @range)
+      this.setRange(_nativeRangeToRange.call(this, nativeRange), silent)
 
 
 module.exports = Scribe

Scribe = require('./scribe')


# DOM Selection API says offset is child index of container, not number of characters like Scribe.Position
normalizeNativePosition = (node, offset) ->


  setRange: (range, silent = false) ->
    return unless @nativeSelection?
    if range?
      nativeRange = rangy.createRangyRange()
      _.each([range.start, range.end], (pos, i) ->
        [node, offset] = Scribe.DOM.findDeepestNode(pos.leafNode, pos.offset)
        node = node.parentNode if node.tagName == "BR"              # Firefox does not like selections inside break tags
        offset = Math.min(Scribe.DOM.getText(node).length, offset)  # Should only occur at end of document
