           expect(markerChangedHandler).not.toHaveBeenCalled()
           expect(marker2ChangedHandler).not.toHaveBeenCalled()
           expect(marker3ChangedHandler).not.toHaveBeenCalled()
-          # but still updates the markers
+
+          # markers positions are updated based on the text change
           expect(marker.getScreenRange()).toEqual [[5, 4], [5, 10]]
           expect(marker.getHeadScreenPosition()).toEqual [5, 10]
           expect(marker.getTailScreenPosition()).toEqual [5, 4]
-          expect(marker2.isValid()).toBeTruthy()
+
+          # but marker snapshots are not restored until the end of the undo.
+          expect(marker2.isValid()).toBeFalsy()
           expect(marker3.isValid()).toBeFalsy()
 
         buffer.undo()

        expect(markerChangedHandler).toHaveBeenCalled()
        expect(marker2ChangedHandler).toHaveBeenCalled()
        expect(marker3ChangedHandler).toHaveBeenCalled()

        # Redo change ----


          expect(markerChangedHandler).not.toHaveBeenCalled()
          expect(marker2ChangedHandler).not.toHaveBeenCalled()
          expect(marker3ChangedHandler).not.toHaveBeenCalled()

          # markers positions are updated based on the text change
          expect(marker.getScreenRange()).toEqual [[5, 7], [5, 13]]
          expect(marker.getHeadScreenPosition()).toEqual [5, 13]
          expect(marker.getTailScreenPosition()).toEqual [5, 7]

          # but marker snapshots are not restored until the end of the undo.
          expect(marker2.isValid()).toBeFalsy()
          expect(marker3.isValid()).toBeFalsy()

        buffer.redo()
        expect(changeHandler).toHaveBeenCalled()
        expect(markerChangedHandler).toHaveBeenCalled()
        expect(marker2ChangedHandler).toHaveBeenCalled()
        expect(marker3ChangedHandler).toHaveBeenCalled()
        expect(marker2.isValid()).toBeFalsy()
        expect(marker3.isValid()).toBeTruthy()

      it "updates the position of markers before emitting change events that aren't caused by a buffer change", ->
        displayBuffer.onDidChange changeHandler = jasmine.createSpy("changeHandler").andCallFake ->
