diff --git a/spec/text-editor-component-spec.js b/spec/text-editor-component-spec.js index 98ecbfaf0..f4324505b 100644 --- a/spec/text-editor-component-spec.js +++ b/spec/text-editor-component-spec.js @@ -485,6 +485,20 @@ describe('TextEditorComponent', () => { await component.getNextUpdatePromise() expect(element.querySelector('.line').classList.contains('cursor-line')).toBe(false) }) + + it('does not render scrollbars', async () => { + const {component, element, editor} = buildComponent({mini: true, autoHeight: false}) + await setEditorWidthInCharacters(component, 10) + await setEditorHeightInLines(component, 1) + + editor.setText('x'.repeat(20) + 'y'.repeat(20)) + await component.getNextUpdatePromise() + + expect(component.isHorizontalScrollbarVisible()).toBe(false) + expect(component.isVerticalScrollbarVisible()).toBe(false) + expect(component.refs.horizontalScrollbar).toBeUndefined() + expect(component.refs.verticalScrollbar).toBeUndefined() + }) }) describe('focus', () => { diff --git a/src/text-editor-component.js b/src/text-editor-component.js index 62c6a704b..1a58d1241 100644 --- a/src/text-editor-component.js +++ b/src/text-editor-component.js @@ -699,7 +699,7 @@ class TextEditorComponent { } renderDummyScrollbars () { - if (this.shouldRenderDummyScrollbars) { + if (this.shouldRenderDummyScrollbars && !this.props.model.isMini()) { let scrollHeight, scrollTop, horizontalScrollbarHeight let scrollWidth, scrollLeft, verticalScrollbarWidth, forceScrollbarVisible @@ -1812,8 +1812,13 @@ class TextEditorComponent { } measureScrollbarDimensions () { - this.measurements.verticalScrollbarWidth = this.refs.verticalScrollbar.getRealScrollbarWidth() - this.measurements.horizontalScrollbarHeight = this.refs.horizontalScrollbar.getRealScrollbarHeight() + if (this.props.model.isMini()) { + this.measurements.verticalScrollbarWidth = 0 + this.measurements.horizontalScrollbarHeight = 0 + } else { + this.measurements.verticalScrollbarWidth = this.refs.verticalScrollbar.getRealScrollbarWidth() + this.measurements.horizontalScrollbarHeight = this.refs.horizontalScrollbar.getRealScrollbarHeight() + } } measureLongestLineWidth () { @@ -2118,7 +2123,9 @@ class TextEditorComponent { } isVerticalScrollbarVisible () { - if (this.props.model.getAutoHeight()) return false + const {model} = this.props + if (model.isMini()) return false + if (model.getAutoHeight()) return false if (this.getContentHeight() > this.getScrollContainerHeight()) return true return ( this.getContentWidth() > this.getScrollContainerWidth() && @@ -2127,8 +2134,10 @@ class TextEditorComponent { } isHorizontalScrollbarVisible () { - if (this.props.model.getAutoWidth()) return false - if (this.props.model.isSoftWrapped()) return false + const {model} = this.props + if (model.isMini()) return false + if (model.getAutoWidth()) return false + if (model.isSoftWrapped()) return false if (this.getContentWidth() > this.getScrollContainerWidth()) return true return ( this.getContentHeight() > this.getScrollContainerHeight() &&