mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Update gutter container only once per frame unless its width changes
Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
@@ -330,9 +330,7 @@ class TextEditorComponent {
|
||||
|
||||
measureContentDuringUpdateSync () {
|
||||
if (this.remeasureGutterDimensions) {
|
||||
if (this.measureGutterDimensions()) {
|
||||
// TODO: Ensure we update the gutter container in the second phase of the update
|
||||
}
|
||||
this.measureGutterDimensions()
|
||||
this.remeasureGutterDimensions = false
|
||||
}
|
||||
const wasHorizontalScrollbarVisible = this.isHorizontalScrollbarVisible()
|
||||
@@ -456,6 +454,7 @@ class TextEditorComponent {
|
||||
key: 'gutterContainer',
|
||||
rootComponent: this,
|
||||
hasInitialMeasurements: this.hasInitialMeasurements,
|
||||
measuredContent: this.measuredContent,
|
||||
scrollTop: this.getScrollTop(),
|
||||
scrollHeight: this.getScrollHeight(),
|
||||
lineNumberGutterWidth: this.getLineNumberGutterWidth(),
|
||||
@@ -2564,8 +2563,17 @@ class GutterContainerComponent {
|
||||
}
|
||||
|
||||
update (props) {
|
||||
this.props = props
|
||||
etch.updateSync(this)
|
||||
if (this.shouldUpdate(props)) {
|
||||
this.props = props
|
||||
etch.updateSync(this)
|
||||
}
|
||||
}
|
||||
|
||||
shouldUpdate (props) {
|
||||
return (
|
||||
!props.measuredContent ||
|
||||
props.lineNumberGutterWidth !== this.props.lineNumberGutterWidth
|
||||
)
|
||||
}
|
||||
|
||||
render () {
|
||||
|
||||
Reference in New Issue
Block a user