 				e.position = position
 				@updateVisibleNames(e)
 
-			session.on "changeScrollTop", (e) =>
+		bindToScrollEvents: () ->
+			@aceEditor.getSession().on "changeScrollTop", (e) =>
 				@updateMoreChangeLabels()
 
 		getPlainDiffContent: () ->

			@insertMarkers()
			@insertNameTag()
			@insertMoreChangeLabels()
			@scrollToFirstChange()
			return @



		updateMoreChangeLabels: () ->
			return if !@$changesBefore or !@$changesAfter
			setTimeout () =>
				firstRow = @aceEditor.getFirstVisibleRow()
				lastRow = @aceEditor.getLastVisibleRow()
				changesBefore = 0
				changesAfter = 0
				@lastHiddenChangeBefore = null
				@firstHiddenChangeAfter = null
				for entry in @entries or []
					if entry.range.start.row < firstRow
						changesBefore += 1
						@lastHiddenChangeBefore = entry
					if entry.range.end.row > lastRow
						changesAfter += 1
						@firstHiddenChangeAfter ||= entry

				if changesBefore > 0
					@$changesBefore.find("span").text("#{changesBefore} more change#{if changesBefore > 1 then "s" else ""} above")
					@$changesBefore.show()
				else
					@$changesBefore.hide()
				if changesAfter > 0
					@$changesAfter.find("span").text("#{changesAfter} more change#{if changesAfter > 1 then "s" else ""} below")
					@$changesAfter.show()
				else
					@$changesAfter.hide()
			, 100

		gotoLastHiddenChangeBefore: () ->
			return if !@lastHiddenChangeBefore
			@aceEditor.scrollToLine(@lastHiddenChangeBefore.range.start.row, true, false)

		gotoFirstHiddenChangeAfter: () ->
			return if !@firstHiddenChangeAfter
			@aceEditor.scrollToLine(@firstHiddenChangeAfter.range.end.row, true, false)

		resize: () ->
			@aceEditor.resize()
