mirror of
https://github.com/atom/atom.git
synced 2026-01-26 15:28:27 -05:00
Guard against null tab length value
Signed-off-by: Antonio Scandurra <as-cii@github.com>
This commit is contained in:
committed by
Antonio Scandurra
parent
1930a11af6
commit
556d79b544
@@ -4878,6 +4878,11 @@ describe "TextEditor", ->
|
||||
editor.setTabLength(6)
|
||||
expect(changeHandler).not.toHaveBeenCalled()
|
||||
|
||||
it 'does not change its tab length when the given tab length is null', ->
|
||||
editor.setTabLength(4)
|
||||
editor.setTabLength(null)
|
||||
expect(editor.getTabLength()).toBe(4)
|
||||
|
||||
describe ".indentLevelForLine(line)", ->
|
||||
it "returns the indent level when the line has only leading whitespace", ->
|
||||
expect(editor.indentLevelForLine(" hello")).toBe(2)
|
||||
|
||||
@@ -241,7 +241,7 @@ class TextEditor extends Model
|
||||
displayLayerParams.atomicSoftTabs = value
|
||||
|
||||
when 'tabLength'
|
||||
if value isnt @tokenizedBuffer.getTabLength()
|
||||
if value? and value isnt @tokenizedBuffer.getTabLength()
|
||||
@tokenizedBuffer.setTabLength(value)
|
||||
displayLayerParams.tabLength = value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user