mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-11 04:48:44 +03:00
Fix wrap guide's font size subscription
This commit is contained in:
parent
ff468371ae
commit
8945a3f64b
@ -28,7 +28,7 @@ describe "WrapGuide", ->
|
||||
expect(width).toBeGreaterThan(0)
|
||||
expect(wrapGuide.position().left).toBe(width)
|
||||
|
||||
describe "font-size-change", ->
|
||||
describe "when the font size changes", ->
|
||||
it "updates the wrap guide position", ->
|
||||
initial = wrapGuide.position().left
|
||||
expect(initial).toBeGreaterThan(0)
|
||||
|
@ -22,15 +22,20 @@ class WrapGuide extends View
|
||||
getGuideColumn: null
|
||||
defaultColumn: 80
|
||||
|
||||
initialize: (@rootView, @editor, config = {}) =>
|
||||
if typeof config.getGuideColumn is 'function'
|
||||
@getGuideColumn = config.getGuideColumn
|
||||
initialize: (@rootView, @editor, options = {}) =>
|
||||
if typeof options.getGuideColumn is 'function'
|
||||
@getGuideColumn = options.getGuideColumn
|
||||
else
|
||||
@getGuideColumn = (path, defaultColumn) -> defaultColumn
|
||||
|
||||
@updateGuide(@editor)
|
||||
@editor.on 'editor-path-change', => @updateGuide(@editor)
|
||||
@rootView.on 'font-size-change', => @updateGuide(@editor)
|
||||
config.on 'update', => @setFontSize(config.editor.fontSize)
|
||||
|
||||
setFontSize: (fontSize) ->
|
||||
return if fontSize == @fontSize
|
||||
@fontSize = fontSize
|
||||
@updateGuide(@editor)
|
||||
|
||||
updateGuide: (editor) ->
|
||||
column = @getGuideColumn(editor.getPath(), @defaultColumn)
|
||||
|
Loading…
Reference in New Issue
Block a user