mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Move autoIndent code into LanguageMode
This commit is contained in:
@@ -197,18 +197,7 @@ class Selection
|
||||
@cursor.setBufferPosition([range.end.row + 1, 0])
|
||||
|
||||
autoIndentText: (text) ->
|
||||
if @editSession.autoIndent
|
||||
mode = @editSession.getCurrentMode()
|
||||
row = @cursor.getCurrentScreenRow()
|
||||
state = @editSession.stateForScreenRow(row)
|
||||
lineBeforeCursor = @cursor.getCurrentBufferLine()[0...@cursor.getBufferPosition().column]
|
||||
if text[0] == "\n"
|
||||
indent = mode.getNextLineIndent(state, lineBeforeCursor, @editSession.tabText)
|
||||
text = text[0] + indent + text[1..]
|
||||
else if mode.checkOutdent(state, lineBeforeCursor, text)
|
||||
shouldOutdent = true
|
||||
|
||||
{text, shouldOutdent}
|
||||
@editSession.autoIndentTextAfterBufferPosition(text, @cursor.getBufferPosition())
|
||||
|
||||
autoOutdentText: ->
|
||||
screenRow = @cursor.getCurrentScreenRow()
|
||||
|
||||
Reference in New Issue
Block a user