WIP: Reworking auto-indent/outdent logic

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-08-09 12:57:47 -06:00
parent ad4b3db439
commit e8aaec43f7
6 changed files with 135 additions and 74 deletions

View File

@@ -247,17 +247,17 @@ class EditSession
largestFoldStartingAtScreenRow: (screenRow) ->
@displayBuffer.largestFoldStartingAtScreenRow(screenRow)
indentationForRow: (row) ->
@languageMode.indentationForRow(row)
autoIndentBufferRows: (startRow, endRow) ->
@languageMode.autoIndentBufferRows(startRow, endRow)
autoIndentRows: (startRow, endRow) ->
@autoIndentRow(row) for row in [startRow..endRow]
autoIndentBufferRow: (bufferRow) ->
@languageMode.autoIndentBufferRow(bufferRow)
autoIndentRow: (row) ->
actualIndentation = @lineForBufferRow(row).match(/^\s*/)[0]
desiredIndentation = @indentationForRow(row)
if actualIndentation != desiredIndentation
@buffer.change([[row, 0], [row, actualIndentation.length]], desiredIndentation)
autoIncreaseIndentForBufferRow: (bufferRow) ->
@languageMode.autoIncreaseIndentForBufferRow(bufferRow)
autoDecreaseIndentForRow: (bufferRow) ->
@languageMode.autoDecreaseIndentForBufferRow(bufferRow)
toggleLineCommentsInRange: (range) ->
@languageMode.toggleLineCommentsInRange(range)