mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Fix clicking past the content height
Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
@@ -114,6 +114,16 @@ describe('TextEditorComponent', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('makes the content at least as tall as the scroll container client height', async () => {
|
||||
const {component, element, editor} = buildComponent({text: 'a', height: 100})
|
||||
expect(component.refs.content.offsetHeight).toBe(100)
|
||||
|
||||
editor.setText('a\n'.repeat(30))
|
||||
await component.getNextUpdatePromise()
|
||||
expect(component.refs.content.offsetHeight).toBeGreaterThan(100)
|
||||
expect(component.refs.content.offsetHeight).toBe(component.getContentHeight())
|
||||
})
|
||||
|
||||
it('honors the scrollPastEnd option by adding empty space equivalent to the clientHeight to the end of the content area', async () => {
|
||||
const {component, element, editor} = buildComponent({autoHeight: false, autoWidth: false})
|
||||
const {scrollContainer} = component.refs
|
||||
|
||||
@@ -2435,8 +2435,10 @@ class TextEditorComponent {
|
||||
3 * this.getLineHeight(),
|
||||
this.getScrollContainerClientHeight() - (3 * this.getLineHeight())
|
||||
)
|
||||
} else {
|
||||
} else if (this.props.model.getAutoHeight()) {
|
||||
return this.getContentHeight()
|
||||
} else {
|
||||
return Math.max(this.getContentHeight(), this.getScrollContainerClientHeight())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user