diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 385fa12eb..24ce7e33c 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -3057,7 +3057,15 @@ describe "TextEditor", -> coffeeEditor.setCursorBufferPosition [0, 10] expect(coffeeEditor.getTabLength(coffeeEditor.scopesAtCursor())).toBe 4 - it 'will retokenize when the tab length is updated', -> + it 'will retokenize when the tab length is updated via .setTabLength()', -> + expect(editor.getTabLength()).toBe 2 + expect(editor.tokenizedLineForScreenRow(5).tokens[0].firstNonWhitespaceIndex).toBe 2 + + editor.setTabLength(6) + expect(editor.getTabLength()).toBe 6 + expect(editor.tokenizedLineForScreenRow(5).tokens[0].firstNonWhitespaceIndex).toBe 6 + + it 'will retokenize when the editor.tabLength setting is updated', -> expect(editor.getTabLength()).toBe 2 expect(editor.tokenizedLineForScreenRow(5).tokens[0].firstNonWhitespaceIndex).toBe 2 diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index 4f7ba6c65..c79712edf 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -117,6 +117,7 @@ class TokenizedBuffer extends Model @tabLength ? atom.config.get(scopeDescriptor ? @grammarScopeDescriptor, 'editor.tabLength') setTabLength: (@tabLength) -> + @retokenizeLines() setInvisibles: (invisibles) -> unless _.isEqual(invisibles, @invisibles)