]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5718 Fix infinite scrolling of sources
authorStas Vilchik <vilchiks@gmail.com>
Tue, 4 Nov 2014 14:50:43 +0000 (15:50 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Tue, 4 Nov 2014 14:50:43 +0000 (15:50 +0100)
server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee

index f269fd143bc1a515c36dd2db4145b44be00e4500..a05373fe66a2f0d90e6667710dac6cb198663aea 100644 (file)
@@ -172,9 +172,11 @@ define [
         @source.set
           source: data.sources
           formattedSource: formattedSource
+        firstLine = _.first(formattedSource).lineNumber
+        lastLine = _.last(formattedSource).lineNumber
         @model.set
-          hasSourceBefore: line > LINES_AROUND
-          hasSourceAfter: formattedSource.length > 2 * LINES_AROUND + 1
+          hasSourceBefore: firstLine > 1
+          hasSourceAfter: lastLine == line + LINES_AROUND
         @render()
         @highlightIssue issue.get 'key'
         @scrollToLine issue.get 'line'