 				diff: null
 			}
 
+		MAX_RECENT_UPDATES_TO_SELECT: 2
 		autoSelectRecentUpdates: () ->
 			return if @$scope.history.updates.length == 0
 

				error:    false
			}

			# TODO: How do we track deleted files now? We can probably show the diffs easily
			# with the new system!
			if true # !doc.deleted
				diff.loading = true
				url = "/project/#{@$scope.project_id}/diff"
				query = ["pathname=#{encodeURIComponent(pathname)}"]
				if diff.fromV? and diff.toV?
					query.push "from=#{diff.fromV}", "to=#{diff.toV}"
				url += "?" + query.join("&")

				@ide.$http
					.get(url)
					.then (response) =>
						{ data } = response
						diff.loading = false
						{text, highlights} = @_parseDiff(data)
						diff.text = text
						diff.highlights = highlights
					.catch () ->
						diff.loading = false
						diff.error = true
			else
				diff.deleted = true
				diff.restoreInProgress = false
				diff.restoreDeletedSuccess = false
				diff.restoredDocNewId = null

		_parseDiff: (diff) ->
			row    = 0


			selected_pathname = @$scope.history.selection.pathname

			for pathname, doc of @_perDocSummaryOfUpdates(@$scope.history.selection.updates)
				if pathname == selected_pathname
					{fromV, toV} = doc
					return {fromV, toV, pathname}

			return {}

		# Set the track changes selected doc to one of the docs in the range
		# of currently selected updates. If we already have a selected doc
