mirror of
https://github.com/atom/atom.git
synced 2026-02-09 14:15:24 -05:00
meta-] indents selected lines
This commit is contained in:
@@ -91,6 +91,9 @@ class CompositeSeleciton
|
||||
insertText: (text) ->
|
||||
@mutateSelectedText (selection) -> selection.insertText(text)
|
||||
|
||||
indentSelectedRows: ->
|
||||
@mutateSelectedText (selection) -> selection.indentSelectedRows()
|
||||
|
||||
backspace: ->
|
||||
@mutateSelectedText (selection) -> selection.backspace()
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ class Editor extends View
|
||||
@on 'select-down', => @selectDown()
|
||||
@on 'newline', => @insertText("\n")
|
||||
@on 'tab', => @insertTab()
|
||||
@on 'indent-selected-rows', => @indentSelectedRows()
|
||||
@on 'backspace', => @backspace()
|
||||
@on 'backspace-to-beginning-of-word', => @backspaceToBeginningOfWord()
|
||||
@on 'delete', => @delete()
|
||||
@@ -424,6 +425,9 @@ class Editor extends View
|
||||
else
|
||||
@compositeSelection.insertText('\t')
|
||||
|
||||
indentSelectedRows: ->
|
||||
@compositeSelection.indentSelectedRows()
|
||||
|
||||
cutSelection: -> @compositeSelection.cut()
|
||||
copySelection: -> @compositeSelection.copy()
|
||||
paste: -> @insertText($native.readFromPasteboard())
|
||||
|
||||
@@ -29,3 +29,4 @@ window.keymap.bindKeys '.editor',
|
||||
'alt-meta-right': 'split-right'
|
||||
'alt-meta-up': 'split-up'
|
||||
'alt-meta-down': 'split-down'
|
||||
'meta-]': 'indent-selected-rows'
|
||||
@@ -105,6 +105,11 @@ class Selection extends View
|
||||
@autoOutdentText() if shouldOutdent
|
||||
@clearSelection()
|
||||
|
||||
indentSelectedRows: ->
|
||||
range = @getBufferRange()
|
||||
for row in [range.start.row..range.end.row]
|
||||
@editor.buffer.insert([row, 0], @editor.tabText) unless @editor.buffer.lineLengthForRow(row) == 0
|
||||
|
||||
autoIndentText: (text) ->
|
||||
if @editor.autoIndent
|
||||
mode = @editor.getCurrentMode()
|
||||
|
||||
Reference in New Issue
Block a user