Emit a grammar-changed event from edit session

This event is now listened for from the editor and
re-emitted under the editor namespace.  This removes
the need to monitor the syntax's grammars-loaded event
from both places and also mirrors the behavior of the
path-changed event.
This commit is contained in:
Kevin Sawicki
2013-03-23 09:00:44 -07:00
parent adcfcb7897
commit e0a93ed1c2
2 changed files with 4 additions and 3 deletions

View File

@@ -841,6 +841,7 @@ class EditSession
if @languageMode.reloadGrammar()
@unfoldAll()
@displayBuffer.tokenizedBuffer.resetScreenLines()
@trigger 'grammar-changed'
true
getDebugSnapshot: ->

View File

@@ -395,8 +395,6 @@ class Editor extends View
e.pageX = @renderedLines.offset().left
onMouseDown(e)
@subscribe syntax, 'grammars-loaded', => @reloadGrammar()
@scrollView.on 'scroll', =>
if @scrollView.scrollLeft() == 0
@gutter.removeClass('drop-shadow')
@@ -456,6 +454,9 @@ class Editor extends View
@reloadGrammar()
@trigger 'editor:path-changed'
@activeEditSession.on "grammar-changed.editor", =>
@trigger 'editor:grammar-changed'
@trigger 'editor:path-changed'
@resetDisplay()
@@ -1150,7 +1151,6 @@ class Editor extends View
if grammarChanged
@clearRenderedLines()
@updateDisplay()
@trigger 'editor:grammar-changed'
grammarChanged
bindToKeyedEvent: (key, event, callback) ->