mirror of
https://github.com/atom/atom.git
synced 2026-02-07 13:14:55 -05:00
Update the status bar asynchronously on cursor move / buffer change
This keeps it out of the synchronous path from pressing a key to seeing it inserted on screen.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
{View} = require 'space-pen'
|
||||
_ = require 'underscore'
|
||||
|
||||
module.exports =
|
||||
class StatusBar extends View
|
||||
@@ -29,15 +30,15 @@ class StatusBar extends View
|
||||
@updatePathText()
|
||||
|
||||
@updateCursorPositionText()
|
||||
@editor.on 'cursor-move', => @updateCursorPositionText()
|
||||
@editor.on 'cursor-move', => _.defer => @updateCursorPositionText()
|
||||
|
||||
@subscribeToBuffer()
|
||||
|
||||
subscribeToBuffer: ->
|
||||
@buffer?.off '.status-bar'
|
||||
@buffer = @editor.getBuffer()
|
||||
@buffer.on 'change.status-bar', => @updateBufferModifiedText()
|
||||
@buffer.on 'after-save.status-bar', => @updateBufferModifiedText()
|
||||
@buffer.on 'change.status-bar', => _.defer => @updateBufferModifiedText()
|
||||
@buffer.on 'after-save.status-bar', => _.defer => @updateBufferModifiedText()
|
||||
@updateBufferModifiedText()
|
||||
|
||||
updateBufferModifiedText: ->
|
||||
|
||||
Reference in New Issue
Block a user