diff --git a/spec/app/tokenized-buffer-spec.coffee b/spec/app/tokenized-buffer-spec.coffee index 2eb7b74fb..7fbff436b 100644 --- a/spec/app/tokenized-buffer-spec.coffee +++ b/spec/app/tokenized-buffer-spec.coffee @@ -383,3 +383,20 @@ describe "TokenizedBuffer", -> expect(tokens[0].scopes).toEqual ["source.c++", "meta.preprocessor.c.include"] expect(tokens[1].value).toBe 'include' expect(tokens[1].scopes).toEqual ["source.c++", "meta.preprocessor.c.include", "keyword.control.import.include.c"] + + describe "when a Ruby source file is tokenized", -> + beforeEach -> + editSession = fixturesProject.buildEditSessionForPath('hello.rb', autoIndent: false) + buffer = editSession.buffer + tokenizedBuffer = editSession.displayBuffer.tokenizedBuffer + editSession.setVisible(true) + fullyTokenize(tokenizedBuffer) + + afterEach -> + editSession.destroy() + + it "doesn't loop infinitely (regression)", -> + expect(tokenizedBuffer.lineForScreenRow(0).text).toBe 'a = {' + expect(tokenizedBuffer.lineForScreenRow(1).text).toBe ' "b" => "c",' + expect(tokenizedBuffer.lineForScreenRow(2).text).toBe '}' + expect(tokenizedBuffer.lineForScreenRow(3).text).toBe '' diff --git a/spec/fixtures/hello.rb b/spec/fixtures/hello.rb new file mode 100644 index 000000000..7cd6688c7 --- /dev/null +++ b/spec/fixtures/hello.rb @@ -0,0 +1,3 @@ +a = { + "b" => "c", +} diff --git a/src/app/text-mate-grammar.coffee b/src/app/text-mate-grammar.coffee index dbba03344..28c599528 100644 --- a/src/app/text-mate-grammar.coffee +++ b/src/app/text-mate-grammar.coffee @@ -53,6 +53,7 @@ class TextMateGrammar tokens.push(nextTokens...) position = tokensEndPosition + break if position is line.length and nextTokens.length is 0 else # push filler token for unmatched text at end of line if position < line.length