This commit is contained in:
Corey Johnson & Nathan Sobo 2012-03-26 15:28:37 -07:00
parent 65b0107811
commit c9b9e30848
2 changed files with 11 additions and 4 deletions

View File

@ -442,3 +442,9 @@ class Editor extends View
unsubscribeFromBuffer: ->
@buffer.off ".editor#{@id}"
@renderer.destroy()
stateForScreenRow: (row) ->
@renderer.lineForRow(row).state
getCurrentMode: ->
@buffer.getMode()

View File

@ -85,12 +85,13 @@ class Selection extends View
autoIndentText: (text) ->
if @editor.autoIndent
mode = @editor.getCurrentMode()
row = @cursor.getScreenPosition().row
state = @editor.renderer.lineForRow(row).state
state = @editor.stateForScreenRow(row)
if text[0] == "\n"
indent = @editor.buffer.mode.getNextLineIndent(state, @cursor.getCurrentBufferLine(), atom.tabText)
indent = mode.getNextLineIndent(state, @cursor.getCurrentBufferLine(), atom.tabText)
text = text[0] + indent + text[1..]
else if @editor.buffer.mode.checkOutdent(state, @cursor.getCurrentBufferLine(), text)
else if mode.checkOutdent(state, @cursor.getCurrentBufferLine(), text)
shouldOutdent = true
{text, shouldOutdent}
@ -99,7 +100,7 @@ class Selection extends View
screenRow = @cursor.getScreenPosition().row
bufferRow = @cursor.getBufferPosition().row
state = @editor.renderer.lineForRow(screenRow).state
@editor.buffer.mode.autoOutdent(state, new AceOutdentAdaptor(@editor.buffer, @editor), bufferRow)
@editor.getCurrentMode().autoOutdent(state, new AceOutdentAdaptor(@editor.buffer, @editor), bufferRow)
backspace: ->
@selectLeft() if @isEmpty()