meta-alt-u unfolds lines at cursor

This commit is contained in:
Corey Johnson 2012-05-22 09:38:14 -07:00
parent ed271fee0f
commit a7d43c2cca
3 changed files with 19 additions and 0 deletions

View File

@ -2436,6 +2436,20 @@ describe "Editor", ->
expect(editor.getCursorBufferPosition()).toEqual [3, 0]
describe "when a cursor is on a fold placeholder line", ->
it "removes the associated fold and places the cursor at its beginning", ->
editor.getSelection().setBufferRange(new Range([3, 0], [9, 0]))
editor.trigger 'fold-selection'
editor.setCursorBufferPosition([3,0])
editor.trigger 'unfold'
expect(editor.find('.fold')).not.toExist()
expect(editor.visibleLines.find('.line:eq(4)').text()).toMatch /4-+/
expect(editor.visibleLines.find('.line:eq(5)').text()).toMatch /5/
expect(editor.getCursorBufferPosition()).toEqual [3, 0]
describe "editor-path-change event", ->
it "emits event when buffer's path is changed", ->
editor = new Editor

View File

@ -119,6 +119,7 @@ class Editor extends View
'redo': @redo
'toggle-soft-wrap': @toggleSoftWrap
'fold-selection': @foldSelection
'unfold': => @unfoldRow(@getCursorBufferPosition().row)
'split-left': @splitLeft
'split-right': @splitRight
'split-up': @splitUp
@ -681,6 +682,9 @@ class Editor extends View
foldSelection: -> @getSelection().fold()
unfoldRow: (row) ->
@renderer.largestFoldForBufferRow(row)?.destroy()
undo: ->
if ranges = @buffer.undo()
@setSelectedBufferRanges(ranges)

View File

@ -28,6 +28,7 @@ window.keymap.bindKeys '.editor',
'meta-Z': 'redo'
'alt-meta-w': 'toggle-soft-wrap'
'alt-meta-f': 'fold-selection'
'alt-meta-u': 'unfold'
'alt-meta-left': 'split-left'
'alt-meta-right': 'split-right'
'alt-meta-up': 'split-up'