Close inactive editor sessions on alt-meta-w

This commit is contained in:
Kevin Sawicki
2013-01-07 15:41:08 -08:00
parent b43c756820
commit 5ded74b3e6
3 changed files with 26 additions and 1 deletions

View File

@@ -176,6 +176,7 @@ class Editor extends View
'editor:toggle-line-comments': @toggleLineCommentsInSelection
'editor:log-cursor-scope': @logCursorScope
'editor:checkout-head-revision': @checkoutHead
'editor:close-other-editors': @destroyInactiveEditSessions
documentation = {}
for name, method of editorBindings
@@ -457,6 +458,14 @@ class Editor extends View
editSession.destroy()
@trigger 'editor:edit-session-removed', [editSession, index]
destroyInactiveEditSessions: ->
index = 0
while session = @editSessions[index]
if @activeEditSession is session or session.buffer.isModified()
index++
else
@destroyEditSessionIndex(index)
loadNextEditSession: ->
nextIndex = (@getActiveEditSessionIndex() + 1) % @editSessions.length
@setActiveEditSessionIndex(nextIndex)