mirror of
https://github.com/atom/atom.git
synced 2026-02-09 22:24:59 -05:00
Tab key inserts spaces or a tab character depending on Editor.prototype.softTabs setting
This commit is contained in:
@@ -37,6 +37,7 @@ class Editor extends View
|
||||
autoIndent: null
|
||||
lineCache: null
|
||||
isFocused: false
|
||||
softTabs: true
|
||||
|
||||
initialize: ({buffer}) ->
|
||||
requireStylesheet 'editor.css'
|
||||
@@ -67,6 +68,7 @@ class Editor extends View
|
||||
@on 'backspace-to-beginning-of-word', => @backspaceToBeginningOfWord()
|
||||
@on 'delete', => @delete()
|
||||
@on 'delete-to-end-of-word', => @deleteToEndOfWord()
|
||||
@on 'tab', => @insertTab()
|
||||
@on 'cut', => @cutSelection()
|
||||
@on 'copy', => @copySelection()
|
||||
@on 'paste', => @paste()
|
||||
@@ -405,6 +407,12 @@ class Editor extends View
|
||||
insertText: (text) ->
|
||||
@compositeSelection.insertText(text)
|
||||
|
||||
insertTab: ->
|
||||
if @softTabs
|
||||
@compositeSelection.insertText(atom.tabText)
|
||||
else
|
||||
@compositeSelection.insertText('\t')
|
||||
|
||||
cutSelection: -> @compositeSelection.cut()
|
||||
copySelection: -> @compositeSelection.copy()
|
||||
paste: -> @insertText($native.readFromPasteboard())
|
||||
|
||||
@@ -15,6 +15,7 @@ window.keymap.bindKeys '.editor',
|
||||
'shift-up': 'select-up'
|
||||
'shift-down': 'select-down'
|
||||
enter: 'newline'
|
||||
tab: 'tab'
|
||||
backspace: 'backspace'
|
||||
'delete': 'delete'
|
||||
'meta-x': 'cut'
|
||||
@@ -27,4 +28,4 @@ window.keymap.bindKeys '.editor',
|
||||
'alt-meta-left': 'split-left'
|
||||
'alt-meta-right': 'split-right'
|
||||
'alt-meta-up': 'split-up'
|
||||
'alt-meta-down': 'split-down'
|
||||
'alt-meta-down': 'split-down'
|
||||
|
||||
Reference in New Issue
Block a user