mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 07:28:08 +03:00
Fix editor element tests on Windows
This commit is contained in:
parent
5848e9b2d0
commit
96533998e2
@ -349,7 +349,16 @@ describe('TextEditorElement', () => {
|
||||
await element.getNextUpdatePromise()
|
||||
expect(element.getVisibleRowRange()).toEqual([4, 11])
|
||||
|
||||
expect(element.pixelRectForScreenRange([[2, 3], [13, 11]])).toEqual({top: 34, left: 22, height: 204, width: 57})
|
||||
const top = 2 * editor.getLineHeightInPixels()
|
||||
const bottom = 13 * editor.getLineHeightInPixels()
|
||||
const left = Math.round(3 * editor.getDefaultCharWidth())
|
||||
const right = Math.round(11 * editor.getDefaultCharWidth())
|
||||
expect(element.pixelRectForScreenRange([[2, 3], [13, 11]])).toEqual({
|
||||
top,
|
||||
left,
|
||||
height: bottom + editor.getLineHeightInPixels() - top,
|
||||
width: right - left
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -2667,7 +2667,7 @@ class TextEditorComponent {
|
||||
|
||||
getScrollLeftColumn () {
|
||||
if (this.hasInitialMeasurements && this.getLongestLineWidth() != null) {
|
||||
return Math.floor(this.getScrollLeft() / this.getBaseCharacterWidth())
|
||||
return Math.round(this.getScrollLeft() / this.getBaseCharacterWidth())
|
||||
} else {
|
||||
return this.pendingScrollLeftColumn || 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user