From df392359f9f0ab72f5cff48e6c7ebfd7ca62c862 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 7 Nov 2012 14:09:31 -0700 Subject: [PATCH] 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. --- spec/app/editor-spec.coffee | 2 ++ src/app/editor.coffee | 2 ++ 2 files changed, 4 insertions(+) diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index 5860af6cd..73d20676b 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -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') diff --git a/src/app/editor.coffee b/src/app/editor.coffee index e4fb4aae8..2d88288f1 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -572,6 +572,8 @@ class Editor extends View if fontSize? @css('font-size', fontSize + 'px') @calculateDimensions() + @updatePaddingOfRenderedLines() + @handleScrollHeightChange() @updateCursorViews() @updateRenderedLines()