mirror of
https://github.com/atom/atom.git
synced 2026-02-09 06:05:11 -05:00
meta-} goes to next buffer
This commit is contained in:
@@ -84,6 +84,7 @@ class Editor extends View
|
||||
@on 'split-up', => @splitUp()
|
||||
@on 'split-down', => @splitDown()
|
||||
@on 'close', => @remove(); false
|
||||
@on 'show-next-buffer', => @loadNextEditorState()
|
||||
|
||||
@on 'move-to-top', => @moveCursorToTop()
|
||||
@on 'move-to-bottom', => @moveCursorToBottom()
|
||||
@@ -223,12 +224,18 @@ class Editor extends View
|
||||
|
||||
setEditorStateForBuffer: (buffer, editorState) ->
|
||||
editorState.buffer = buffer
|
||||
existingEditorState = @getEditorStateForBuffer(buffer)
|
||||
if existingEditorState
|
||||
_.extend(existingEditorState, editorState)
|
||||
index = @indexOfEditorState(editorState)
|
||||
if index?
|
||||
@editorStates[index] = editorState
|
||||
else
|
||||
@editorStates.push(editorState)
|
||||
|
||||
indexOfEditorState: (editorState) ->
|
||||
for o, i in @editorStates
|
||||
return i if o.buffer.id == editorState.buffer.id
|
||||
|
||||
return null
|
||||
|
||||
loadEditorStateForBuffer: (buffer) ->
|
||||
editorState = @getEditorStateForBuffer(buffer)
|
||||
if not editorState
|
||||
@@ -238,6 +245,12 @@ class Editor extends View
|
||||
@scroller.scrollTop(editorState.scrollTop ? 0)
|
||||
@scroller.scrollLeft(editorState.scrollLeft ? 0)
|
||||
|
||||
loadNextEditorState: ->
|
||||
index = @indexOfEditorState(@getEditorState())
|
||||
if index?
|
||||
nextIndex = (index + 1) % @editorStates.length
|
||||
@setEditorState(@editorStates[nextIndex])
|
||||
|
||||
setEditorState: (editorState={}) ->
|
||||
buffer = editorState.buffer ?= new Buffer
|
||||
@setEditorStateForBuffer(buffer, editorState)
|
||||
|
||||
@@ -30,4 +30,5 @@ window.keymap.bindKeys '.editor',
|
||||
'alt-meta-up': 'split-up'
|
||||
'alt-meta-down': 'split-down'
|
||||
'meta-[': 'outdent-selected-rows'
|
||||
'meta-]': 'indent-selected-rows'
|
||||
'meta-]': 'indent-selected-rows'
|
||||
'meta-}': 'show-next-buffer'
|
||||
Reference in New Issue
Block a user