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)

View File

@@ -4,7 +4,6 @@
'meta-enter': 'editor:newline-below'
'tab': 'editor:indent'
'meta-d': 'editor:delete-line'
'alt-meta-w': 'editor:toggle-soft-wrap'
'ctrl-[': 'editor:fold-current-row'
'ctrl-]': 'editor:unfold-current-row'
'ctrl-{': 'editor:fold-all'
@@ -33,3 +32,4 @@
'meta-alt-p': 'editor:log-cursor-scope'
'meta-u': 'editor:upper-case'
'meta-U': 'editor:lower-case'
'alt-meta-w': 'editor:close-other-editors'