mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Calculate gutter dimensions when editor's dimensions are calculated
This commit is contained in:
@@ -499,7 +499,7 @@ class Editor extends View
|
||||
rootView.on "font-size-change.editor#{@id}", => @setFontSize(rootView.getFontSize())
|
||||
|
||||
setFontSize: (fontSize) ->
|
||||
if fontSize
|
||||
if fontSize?
|
||||
@css('font-size', fontSize + 'px')
|
||||
@calculateDimensions()
|
||||
@updateCursorViews()
|
||||
@@ -627,6 +627,8 @@ class Editor extends View
|
||||
@height(@lineHeight) if @mini
|
||||
fragment.remove()
|
||||
|
||||
@gutter.calculateDimensions()
|
||||
|
||||
prepareForScrolling: ->
|
||||
@adjustHeightOfRenderedLines()
|
||||
@adjustWidthOfRenderedLines()
|
||||
|
||||
@@ -9,14 +9,19 @@ class Gutter extends View
|
||||
@div class: 'gutter', =>
|
||||
@div outlet: 'lineNumbers', class: 'wtf'
|
||||
|
||||
renderLineNumbers: (startScreenRow, endScreenRow) ->
|
||||
editor: ->
|
||||
editor = @parentView
|
||||
|
||||
renderLineNumbers: (startScreenRow, endScreenRow) ->
|
||||
lastScreenRow = -1
|
||||
rows = editor.bufferRowsForScreenRows(startScreenRow, endScreenRow)
|
||||
rows = @editor().bufferRowsForScreenRows(startScreenRow, endScreenRow)
|
||||
|
||||
@lineNumbers[0].innerHTML = $$$ ->
|
||||
for row in rows
|
||||
@div {class: 'line-number'}, if row == lastScreenRow then '•' else row + 1
|
||||
lastScreenRow = row
|
||||
|
||||
@lineNumbers.width(editor.buffer.getLastRow().toString().length * editor.charWidth)
|
||||
@calculateDimensions()
|
||||
|
||||
calculateDimensions: ->
|
||||
@lineNumbers.width(@editor().buffer.getLastRow().toString().length * @editor().charWidth)
|
||||
|
||||
Reference in New Issue
Block a user