Add newline-below event

This commit is contained in:
Corey Johnson
2012-06-05 11:29:40 -07:00
parent afab19938e
commit 4f364e8cd8
3 changed files with 17 additions and 3 deletions

View File

@@ -105,6 +105,7 @@ class Editor extends View
'select-up': @selectUp
'select-down': @selectDown
'newline': @insertNewline
'newline-below': @insertNewlineBelow
'tab': @insertTab
'indent-selected-rows': @indentSelectedRows
'outdent-selected-rows': @outdentSelectedRows
@@ -702,6 +703,10 @@ class Editor extends View
insertNewline: ->
@insertText('\n')
insertNewlineBelow: ->
@moveCursorToEndOfLine()
@insertNewline()
insertTab: ->
if @getSelection().isEmpty()
if @softTabs

View File

@@ -5,9 +5,10 @@ window.keymap.bindKeys '.editor',
'shift-up': 'select-up'
'shift-down': 'select-down'
'meta-a': 'select-all'
enter: 'newline'
tab: 'tab'
backspace: 'backspace'
'enter': 'newline'
'meta-enter': 'newline-below'
'tab': 'tab'
'backspace': 'backspace'
'delete': 'delete'
'meta-x': 'cut'
'meta-c': 'copy'