Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Take 2: Use 70% less memory for TokenizedLines #6892

Merged
merged 5 commits into from
May 22, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Correctly compute bufferDelta for last soft wrap line segment
Fixes #6885
  • Loading branch information
Nathan Sobo committed May 21, 2015
commit 865015e47dce688b45e84fec4b5ca4d9e1a305f6
3 changes: 3 additions & 0 deletions spec/display-buffer-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ describe "DisplayBuffer", ->
buffer.setTextInRange([[0, 0], [1, 0]], 'abcdefghijklmnopqrstuvwxyz\n')
displayBuffer.setEditorWidthInChars(10)
expect(displayBuffer.tokenizedLineForScreenRow(0).text).toBe 'abcdefghij'
expect(displayBuffer.tokenizedLineForScreenRow(0).bufferDelta).toBe 'abcdefghij'.length
expect(displayBuffer.tokenizedLineForScreenRow(1).text).toBe 'klmnopqrst'
expect(displayBuffer.tokenizedLineForScreenRow(1).bufferDelta).toBe 'klmnopqrst'.length
expect(displayBuffer.tokenizedLineForScreenRow(2).text).toBe 'uvwxyz'
expect(displayBuffer.tokenizedLineForScreenRow(2).bufferDelta).toBe 'uvwxyz'.length

describe "when there is a whitespace character at the max length boundary", ->
it "wraps the line at the first non-whitespace character following the boundary", ->
Expand Down
2 changes: 1 addition & 1 deletion src/tokenized-line.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ class TokenizedLine
rightFragment.tags = rightTags
rightFragment.specialTokens = rightSpecialTokens
rightFragment.startBufferColumn = splitBufferColumn
rightFragment.bufferDelta = @bufferDelta - splitBufferColumn
rightFragment.bufferDelta = @startBufferColumn + @bufferDelta - splitBufferColumn
rightFragment.ruleStack = @ruleStack
rightFragment.invisibles = @invisibles
rightFragment.lineEnding = @lineEnding
Expand Down