mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-11 04:48:44 +03:00
Set width to 0 on tester element
This commit is contained in:
parent
b1138601fc
commit
2de14a701f
@ -13,14 +13,15 @@ class Gutter extends View
|
||||
highestNumberWidth: null
|
||||
|
||||
afterAttach: (onDom) ->
|
||||
@editor()?.on 'cursor-move', => @highlightCursorLine()
|
||||
@editor().on 'cursor-move', => @highlightCursorLine()
|
||||
@calculateWidth() if onDom
|
||||
|
||||
editor: ->
|
||||
@parentView
|
||||
|
||||
lineNumberPadding: ->
|
||||
calculateLineNumberPadding: ->
|
||||
widthTesterElement = $$ -> @div {class: 'line-number'}, ""
|
||||
widthTesterElement.width(0)
|
||||
@append(widthTesterElement)
|
||||
lineNumberPadding = widthTesterElement.outerWidth()
|
||||
widthTesterElement.remove()
|
||||
@ -53,7 +54,7 @@ class Gutter extends View
|
||||
highestNumberWidth = @editor().getLineCount().toString().length * @editor().charWidth
|
||||
if highestNumberWidth != @highestNumberWidth
|
||||
@highestNumberWidth = highestNumberWidth
|
||||
@lineNumbers.width(highestNumberWidth + @lineNumberPadding())
|
||||
@lineNumbers.width(highestNumberWidth + @calculateLineNumberPadding())
|
||||
@widthChanged?(@outerWidth())
|
||||
|
||||
highlightCursorLine: ->
|
||||
|
Loading…
Reference in New Issue
Block a user