mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
Wait for content width to update before autoscrolling horizontally
This commit is contained in:
parent
758466c9af
commit
5d82dcf87a
@ -391,6 +391,19 @@ describe('TextEditorComponent', () => {
|
||||
)
|
||||
expect(scroller.scrollLeft).toBe(expectedScrollLeft)
|
||||
})
|
||||
|
||||
it('correctly autoscrolls after inserting a line that exceeds the current content width', async () => {
|
||||
const {component, element, editor} = buildComponent()
|
||||
const {scroller} = component.refs
|
||||
element.style.width = component.getScrollWidth() + 'px'
|
||||
await component.getNextUpdatePromise()
|
||||
|
||||
editor.setCursorScreenPosition([0, Infinity])
|
||||
editor.insertText('x'.repeat(100))
|
||||
await component.getNextUpdatePromise()
|
||||
|
||||
expect(scroller.scrollLeft).toBe(component.getScrollWidth() - scroller.clientWidth)
|
||||
})
|
||||
})
|
||||
|
||||
describe('line and line number decorations', () => {
|
||||
|
@ -107,11 +107,11 @@ class TextEditorComponent {
|
||||
|
||||
this.measureHorizontalPositions()
|
||||
if (longestLineToMeasure) this.measureLongestLineWidth(longestLineToMeasure)
|
||||
if (this.pendingAutoscroll) this.finalizeAutoscroll()
|
||||
this.updateAbsolutePositionedDecorations()
|
||||
|
||||
etch.updateSync(this)
|
||||
|
||||
if (this.pendingAutoscroll) this.finalizeAutoscroll()
|
||||
this.currentFrameLineNumberGutterProps = null
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user