mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2025-01-06 23:26:25 +03:00
Fix LanguageMode.proto.suggestedIndentationForBufferRow
exception for row 0
This commit is contained in:
parent
b5b552737d
commit
4d9b777350
@ -109,6 +109,14 @@ describe "LanguageMode", ->
|
||||
expect(languageMode.rowRangeForFoldAtBufferRow(2)).toBeNull()
|
||||
expect(languageMode.rowRangeForFoldAtBufferRow(4)).toEqual [4, 7]
|
||||
|
||||
describe "suggestedIndentForBufferRow", ->
|
||||
it "returns the suggested indentation based on auto-indent/outdent rules", ->
|
||||
expect(languageMode.suggestedIndentForBufferRow(0)).toBe 0
|
||||
expect(languageMode.suggestedIndentForBufferRow(1)).toBe 2
|
||||
expect(languageMode.suggestedIndentForBufferRow(2)).toBe 4
|
||||
expect(languageMode.suggestedIndentForBufferRow(9)).toBe 2
|
||||
|
||||
|
||||
describe "coffeescript", ->
|
||||
beforeEach ->
|
||||
editSession = fixturesProject.buildEditSessionForPath('coffee.coffee', autoIndent: false)
|
||||
|
@ -92,7 +92,8 @@ class LanguageMode
|
||||
return currentIndentation unless increaseIndentPattern = TextMateBundle.indentRegexForScope(scopes[0])
|
||||
|
||||
currentLine = @buffer.lineForRow(bufferRow)
|
||||
precedingRow = @buffer.previousNonBlankRow(bufferRow)
|
||||
return currentIndentation unless precedingRow = @buffer.previousNonBlankRow(bufferRow)
|
||||
|
||||
precedingLine = @buffer.lineForRow(precedingRow)
|
||||
|
||||
desiredIndentation = @buffer.indentationForRow(precedingRow)
|
||||
|
Loading…
Reference in New Issue
Block a user