Update wrapped screen lines when default width changes

This commit is contained in:
Antonio Scandurra
2015-10-15 18:10:26 +02:00
parent 4c66341624
commit 4818d47980
2 changed files with 3 additions and 2 deletions

View File

@@ -54,16 +54,16 @@ describe "DisplayBuffer", ->
describe "soft wrapping", ->
beforeEach ->
displayBuffer.setDefaultCharWidth(1)
displayBuffer.setEditorWidthInChars(50)
displayBuffer.setSoftWrapped(true)
displayBuffer.setDefaultCharWidth(1)
changeHandler.reset()
describe "rendering of soft-wrapped lines", ->
describe "when there are double width characters", ->
it "takes them into account when finding the soft wrap column", ->
displayBuffer.setDefaultCharWidth(1, 5)
buffer.setText("私たちのフ是一个地方数千名学生12345业余爱们的板作为우리포럼hello world this is a pretty long latin line")
displayBuffer.setDefaultCharWidth(1, 5)
expect(displayBuffer.tokenizedLineForScreenRow(0).text).toBe("私たちのフ是一个地方")
expect(displayBuffer.tokenizedLineForScreenRow(1).text).toBe("数千名学生12345业余爱")

View File

@@ -195,6 +195,7 @@ class DisplayBuffer extends Model
if defaultCharWidth isnt @defaultCharWidth or doubleWidthCharWidth isnt @doubleWidthCharWidth
@defaultCharWidth = defaultCharWidth
@doubleWidthCharWidth = doubleWidthCharWidth
@updateWrappedScreenLines() if @isSoftWrapped()
defaultCharWidth
getCursorWidth: -> 1