mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-22 00:19:24 +03:00
Close all editors in pane with meta-P
This commit is contained in:
parent
fffba45b50
commit
7465ae5052
@ -2077,3 +2077,15 @@ describe "Editor", ->
|
||||
expect(atom.confirm).toHaveBeenCalled()
|
||||
expect(editor.getEditSessions().length).toBe 2
|
||||
expect(editor.getEditSessions()[0].buffer.isModified()).toBeTruthy()
|
||||
|
||||
describe ".destroyAllEditSessions()", ->
|
||||
it "destroys every edit session", ->
|
||||
rootView.open('sample.txt')
|
||||
rootView.open('css.css')
|
||||
rootView.open('coffee.coffee')
|
||||
rootView.open('hello.rb')
|
||||
expect(editor.getEditSessions().length).toBe 5
|
||||
editor.setActiveEditSessionIndex(2)
|
||||
editor.destroyAllEditSessions()
|
||||
expect(editor.pane()).toBeUndefined()
|
||||
expect(editor.getEditSessions().length).toBe 0
|
||||
|
@ -177,6 +177,7 @@ class Editor extends View
|
||||
'editor:log-cursor-scope': @logCursorScope
|
||||
'editor:checkout-head-revision': @checkoutHead
|
||||
'editor:close-other-editors': @destroyInactiveEditSessions
|
||||
'editor:close-all-editors': @destroyAllEditSessions
|
||||
|
||||
documentation = {}
|
||||
for name, method of editorBindings
|
||||
@ -470,6 +471,12 @@ class Editor extends View
|
||||
index++ if @activeEditSession is @editSessions[index]
|
||||
@destroyEditSessionIndex(index, destroyIndex) if @editSessions[index]
|
||||
destroyIndex(0)
|
||||
|
||||
destroyAllEditSessions: ->
|
||||
destroyIndex = (index) =>
|
||||
@destroyEditSessionIndex(index, destroyIndex) if @editSessions[index]
|
||||
destroyIndex(0)
|
||||
|
||||
loadNextEditSession: ->
|
||||
nextIndex = (@getActiveEditSessionIndex() + 1) % @editSessions.length
|
||||
@setActiveEditSessionIndex(nextIndex)
|
||||
|
@ -33,3 +33,4 @@
|
||||
'meta-u': 'editor:upper-case'
|
||||
'meta-U': 'editor:lower-case'
|
||||
'alt-meta-w': 'editor:close-other-editors'
|
||||
'meta-P': 'editor:close-all-editors'
|
||||
|
Loading…
Reference in New Issue
Block a user