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


		updateMoreChangeLabels: () ->
			return if !@$changesBefore or !@$changesAfter
			firstRow = @aceEditor.renderer.getFirstFullyVisibleRow()
			lastRow = @aceEditor.renderer.getLastFullyVisibleRow()
			changesBefore = 0
			changesAfter = 0
			for entry in @entries or []
				if entry.range.start.row < firstRow
					changesBefore += 1
				if entry.range.end.row > lastRow
					changesAfter += 1
			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()

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

			@$ace.append(@$nameTagEl)

		insertMoreChangeLabels: () ->
			@$changesBefore = $("<a class='changes-before' href='#'><span></span> <i class='icon-arrow-up'></a>")
			@$changesAfter = $("<a class='changes-after' href='#'><span></span> <i class='icon-arrow-down'></a>")
			@$ace.append(@$changesBefore)
			@$ace.append(@$changesAfter)
			@$changesBefore.on "click", () =>
				@gotoLastHiddenChangeBefore()
			@$changesAfter.on "click", () =>
				@gotoFirstHiddenChangeAfter()
			@updateMoreChangeLabels()

		scrollToFirstChange: () ->
			@aceEditor.scrollToLine(0)
			setTimeout () =>
				if @entries? and @entries[0]?
					row = @entries[0].range.start.row
					@aceEditor.scrollToLine(row, true, false)
			, 10

		_drawNameTag: (entry, position) ->
			@$nameTagEl.show()
