mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Use .subscribe and .observeConfig in WrapGuide
This commit is contained in:
@@ -28,15 +28,9 @@ class WrapGuide extends View
|
||||
else
|
||||
@getGuideColumn = (path, defaultColumn) -> defaultColumn
|
||||
|
||||
@updateGuide(@editor)
|
||||
@editor.on 'editor-path-change', => @updateGuide(@editor)
|
||||
config.on 'update', => @setFontSize(config.editor.fontSize)
|
||||
@editor.on 'before-remove', => @rootView.off('.wrap-guide')
|
||||
|
||||
setFontSize: (fontSize) ->
|
||||
return if fontSize == @fontSize
|
||||
@fontSize = fontSize
|
||||
@updateGuide(@editor)
|
||||
@observeConfig 'editor.fontSize', => @updateGuide(@editor)
|
||||
@subscribe @editor, 'editor-path-change', => @updateGuide(@editor)
|
||||
@subscribe @editor, 'before-remove', => @rootView.off('.wrap-guide')
|
||||
|
||||
updateGuide: (editor) ->
|
||||
column = @getGuideColumn(editor.getPath(), @defaultColumn)
|
||||
|
||||
Reference in New Issue
Block a user