diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index baa8e45b4..2c4ba084f 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -4876,6 +4876,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) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 9c8f28b71..034b9e8f0 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -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