When font size changes, correctly adjust scrollable height

This requires updating the padding of the rendered lines and then adjusting the vertical scrollbar content height before updating any of the rendered lines. This fixes (hopefully all of) the rendering issues when adjusting the font size.
This commit is contained in:
Nathan Sobo
2012-11-07 14:09:31 -07:00
parent 693b110f1c
commit df392359f9
2 changed files with 4 additions and 0 deletions

View File

@@ -493,6 +493,8 @@ describe "Editor", ->
expect(editor.lineHeight).toBeGreaterThan lineHeightBefore
expect(editor.charWidth).toBeGreaterThan charWidthBefore
expect(editor.getCursorView().position()).toEqual { top: 5 * editor.lineHeight, left: 6 * editor.charWidth }
expect(editor.renderedLines.outerHeight()).toBe buffer.getLineCount() * editor.lineHeight
expect(editor.verticalScrollbarContent.height()).toBe buffer.getLineCount() * editor.lineHeight
# ensure we clean up font size subscription
editor.trigger('core:close')

View File

@@ -572,6 +572,8 @@ class Editor extends View
if fontSize?
@css('font-size', fontSize + 'px')
@calculateDimensions()
@updatePaddingOfRenderedLines()
@handleScrollHeightChange()
@updateCursorViews()
@updateRenderedLines()