mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Measure half width characters
This commit is contained in:
@@ -8,8 +8,10 @@ DummyLineNode.style.position = 'absolute'
|
||||
DummyLineNode.style.visibility = 'hidden'
|
||||
DummyLineNode.appendChild(document.createElement('span'))
|
||||
DummyLineNode.appendChild(document.createElement('span'))
|
||||
DummyLineNode.appendChild(document.createElement('span'))
|
||||
DummyLineNode.children[0].textContent = 'x'
|
||||
DummyLineNode.children[1].textContent = '我'
|
||||
DummyLineNode.children[2].textContent = 'ハ'
|
||||
|
||||
RangeForMeasurement = document.createRange()
|
||||
|
||||
@@ -85,11 +87,12 @@ class LinesComponent extends TiledComponent
|
||||
lineHeightInPixels = DummyLineNode.getBoundingClientRect().height
|
||||
defaultCharWidth = DummyLineNode.children[0].getBoundingClientRect().width
|
||||
doubleWidthCharWidth = DummyLineNode.children[1].getBoundingClientRect().width
|
||||
halfWidthCharWidth = DummyLineNode.children[2].getBoundingClientRect().width
|
||||
|
||||
@domNode.removeChild(DummyLineNode)
|
||||
|
||||
@presenter.setLineHeight(lineHeightInPixels)
|
||||
@presenter.setBaseCharacterWidth(defaultCharWidth, doubleWidthCharWidth)
|
||||
@presenter.setBaseCharacterWidth(defaultCharWidth, doubleWidthCharWidth, halfWidthCharWidth)
|
||||
|
||||
lineNodeForLineIdAndScreenRow: (lineId, screenRow) ->
|
||||
tile = @presenter.tileForRow(screenRow)
|
||||
|
||||
@@ -1122,11 +1122,12 @@ class TextEditorPresenter
|
||||
@mouseWheelScreenRow = screenRow
|
||||
@didStartScrolling()
|
||||
|
||||
setBaseCharacterWidth: (baseCharacterWidth, doubleWidthCharWidth) ->
|
||||
unless @baseCharacterWidth is baseCharacterWidth and @doubleWidthCharWidth is doubleWidthCharWidth
|
||||
setBaseCharacterWidth: (baseCharacterWidth, doubleWidthCharWidth, halfWidthCharWidth) ->
|
||||
unless @baseCharacterWidth is baseCharacterWidth and @doubleWidthCharWidth is doubleWidthCharWidth and @halfWidthCharWidth is halfWidthCharWidth
|
||||
@baseCharacterWidth = baseCharacterWidth
|
||||
@doubleWidthCharWidth = doubleWidthCharWidth
|
||||
@model.setDefaultCharWidth(baseCharacterWidth, doubleWidthCharWidth)
|
||||
@halfWidthCharWidth = halfWidthCharWidth
|
||||
@model.setDefaultCharWidth(baseCharacterWidth, doubleWidthCharWidth, halfWidthCharWidth)
|
||||
@characterWidthsChanged()
|
||||
|
||||
characterWidthsChanged: ->
|
||||
|
||||
Reference in New Issue
Block a user