mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Call editor.setEditorWidthInChars only when the value changed
Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
committed by
Nathan Sobo
parent
a7f658a40f
commit
245f294cc3
@@ -1964,10 +1964,15 @@ class TextEditorComponent {
|
||||
}
|
||||
|
||||
updateModelSoftWrapColumn () {
|
||||
this.suppressUpdates = true
|
||||
this.props.model.setEditorWidthInChars(this.getScrollContainerClientWidthInBaseCharacters())
|
||||
this.props.model.setEditorWidthInChars(this.getScrollContainerClientWidthInBaseCharacters())
|
||||
this.suppressUpdates = false
|
||||
const {model} = this.props
|
||||
const newEditorWidthInChars = this.getScrollContainerClientWidthInBaseCharacters()
|
||||
if (newEditorWidthInChars !== model.getEditorWidthInChars()) {
|
||||
this.suppressUpdates = true
|
||||
this.props.model.setEditorWidthInChars(newEditorWidthInChars)
|
||||
// Wrapping may cause a vertical scrollbar to appear, which will change the width again.
|
||||
this.props.model.setEditorWidthInChars(this.getScrollContainerClientWidthInBaseCharacters())
|
||||
this.suppressUpdates = false
|
||||
}
|
||||
}
|
||||
|
||||
// This method exists because it existed in the previous implementation and some
|
||||
|
||||
Reference in New Issue
Block a user