Fix ::longestScreenRow update for changes directly above longest line

Fixes #5716
This commit is contained in:
Nathan Sobo 2015-02-24 11:35:52 -07:00
parent 622caee446
commit 5fdb3cde08
2 changed files with 8 additions and 8 deletions

View File

@ -666,16 +666,16 @@ describe "DisplayBuffer", ->
it "correctly updates the location of the longest screen line when changes occur", ->
expect(displayBuffer.getLongestScreenRow()).toBe 6
buffer.delete([[0, 0], [2, 0]])
buffer.delete([[3, 0], [5, 0]])
expect(displayBuffer.getLongestScreenRow()).toBe 4
buffer.delete([[4, 0], [5, 0]])
expect(displayBuffer.getLongestScreenRow()).toBe 5
expect(displayBuffer.getMaxLineLength()).toBe 56
expect(displayBuffer.getLongestScreenRow()).toBe 1
expect(displayBuffer.getMaxLineLength()).toBe 62
buffer.delete([[2, 0], [4, 0]])
expect(displayBuffer.getLongestScreenRow()).toBe 1
expect(displayBuffer.getMaxLineLength()).toBe 62
buffer.delete([[6, 0], [8, 0]])
expect(displayBuffer.getLongestScreenRow()).toBe 5
expect(displayBuffer.getMaxLineLength()).toBe 56
describe "::destroy()", ->
it "unsubscribes all display buffer markers from their underlying buffer marker (regression)", ->

View File

@ -1189,7 +1189,7 @@ class DisplayBuffer extends Model
maxLengthCandidatesStartRow = 0
maxLengthCandidates = @screenLines
else
@longestScreenRow += screenDelta if endScreenRow < @longestScreenRow
@longestScreenRow += screenDelta if endScreenRow <= @longestScreenRow
maxLengthCandidatesStartRow = startScreenRow
maxLengthCandidates = newScreenLines