mirror of
https://github.com/atom/atom.git
synced 2026-02-09 06:05:11 -05:00
Inserting a newline indents the cursor (based on information from previous line)
This commit is contained in:
@@ -300,7 +300,14 @@ class Editor extends View
|
||||
selectToBufferPosition: (position) ->
|
||||
@selection.selectToBufferPosition(position)
|
||||
|
||||
insertText: (text) -> @selection.insertText(text)
|
||||
insertText: (text) ->
|
||||
if text[0] == "\n"
|
||||
tab = " "
|
||||
state = @lineWrapper.lineForScreenRow(@getRow).state
|
||||
indent = @buffer.mode.getNextLineIndent(state, @getCurrentLine(), tab)
|
||||
text = text[0] + indent + text[1..]
|
||||
|
||||
@selection.insertText(text)
|
||||
|
||||
cutSelection: -> @selection.cut()
|
||||
copySelection: -> @selection.copy()
|
||||
|
||||
Reference in New Issue
Block a user