mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Assign line and character measurements on model via presenter
This commit is contained in:
@@ -253,9 +253,7 @@ LinesComponent = React.createClass
|
||||
|
||||
{editor, presenter} = @props
|
||||
presenter.setLineHeight(lineHeightInPixels)
|
||||
editor.setLineHeightInPixels(lineHeightInPixels)
|
||||
presenter.setBaseCharacterWidth(charWidth)
|
||||
editor.setDefaultCharWidth(charWidth)
|
||||
|
||||
remeasureCharacterWidths: ->
|
||||
return unless @props.presenter.hasRequiredMeasurements()
|
||||
@@ -312,7 +310,6 @@ LinesComponent = React.createClass
|
||||
rangeForMeasurement.setStart(textNode, i)
|
||||
rangeForMeasurement.setEnd(textNode, i + charLength)
|
||||
charWidth = rangeForMeasurement.getBoundingClientRect().width
|
||||
editor.setScopedCharWidth(scopes, char, charWidth)
|
||||
@props.presenter.setScopedCharacterWidth(scopes, char, charWidth)
|
||||
|
||||
charIndex += charLength
|
||||
|
||||
@@ -537,6 +537,7 @@ class TextEditorPresenter
|
||||
setLineHeight: (lineHeight) ->
|
||||
unless @lineHeight is lineHeight
|
||||
@lineHeight = lineHeight
|
||||
@model.setLineHeightInPixels(lineHeight)
|
||||
@updateHeightState()
|
||||
@updateVerticalScrollState()
|
||||
@updateDecorations()
|
||||
@@ -574,8 +575,9 @@ class TextEditorPresenter
|
||||
@batchingCharacterMeasurement = false
|
||||
@characterWidthsChanged() if oldChangeCount isnt @scopedCharacterWidthsChangeCount
|
||||
|
||||
setScopedCharacterWidth: (scopeNames, char, width) ->
|
||||
@getScopedCharacterWidths(scopeNames)[char] = width
|
||||
setScopedCharacterWidth: (scopeNames, character, width) ->
|
||||
@getScopedCharacterWidths(scopeNames)[character] = width
|
||||
@model.setScopedCharWidth(scopeNames, character, width)
|
||||
@scopedCharacterWidthsChangeCount++
|
||||
@characterWidthsChanged() unless @batchingCharacterMeasurement
|
||||
|
||||
|
||||
Reference in New Issue
Block a user