From 61583462cf04162b918ac0bed4f37555d60546be Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 27 Mar 2017 10:23:55 -0600 Subject: [PATCH] Set the height of the line number gutter explicitly --- spec/text-editor-component-spec.js | 13 ++++++++----- src/text-editor-component.js | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/spec/text-editor-component-spec.js b/spec/text-editor-component-spec.js index 2e1b66e16..4e45918ef 100644 --- a/spec/text-editor-component-spec.js +++ b/spec/text-editor-component-spec.js @@ -108,15 +108,18 @@ fdescribe('TextEditorComponent', () => { it('gives the line number tiles an explicit width and height so their layout can be strictly contained', async () => { const {component, element, editor} = buildComponent({rowsPerTile: 3}) - const gutterElement = component.refs.lineNumberGutter.element - for (const child of gutterElement.children) { - expect(child.offsetWidth).toBe(gutterElement.offsetWidth) + const lineNumberGutterElement = component.refs.lineNumberGutter.element + expect(lineNumberGutterElement.offsetHeight).toBe(component.getScrollHeight()) + + for (const child of lineNumberGutterElement.children) { + expect(child.offsetWidth).toBe(lineNumberGutterElement.offsetWidth) } editor.setText('\n'.repeat(99)) await component.getNextUpdatePromise() - for (const child of gutterElement.children) { - expect(child.offsetWidth).toBe(gutterElement.offsetWidth) + expect(lineNumberGutterElement.offsetHeight).toBe(component.getScrollHeight()) + for (const child of lineNumberGutterElement.children) { + expect(child.offsetWidth).toBe(lineNumberGutterElement.offsetWidth) } }) diff --git a/src/text-editor-component.js b/src/text-editor-component.js index a895997a1..7437c3225 100644 --- a/src/text-editor-component.js +++ b/src/text-editor-component.js @@ -2151,7 +2151,7 @@ class LineNumberGutterComponent { { className: 'gutter line-numbers', attributes: {'gutter-name': 'line-number'}, - style: {position: 'relative'}, + style: {position: 'relative', height: height + 'px'}, on: { mousedown: this.didMouseDown },