diff --git a/spec/atom/editor-spec.coffee b/spec/atom/editor-spec.coffee index 8ecb1ab47..c7707e076 100644 --- a/spec/atom/editor-spec.coffee +++ b/spec/atom/editor-spec.coffee @@ -39,6 +39,12 @@ describe "Editor", -> line12 = editor.lines.find('.line:eq(11)') expect(line12.find('span:eq(1)')).toMatchSelector '.keyword' + describe "when lines are updated in the buffer", -> + it "syntax highlights the updated lines", -> + expect(editor.lines.find('.line:eq(0) span:eq(0)')).toMatchSelector '.keyword.definition' + buffer.insert([0, 4], "g") + expect(editor.lines.find('.line:eq(0) span:eq(0)')).toMatchSelector '.keyword.definition' + describe "cursor movement", -> describe ".setCursorPosition({row, column})", -> beforeEach -> diff --git a/src/atom/editor.coffee b/src/atom/editor.coffee index e2428eda8..86eded41a 100644 --- a/src/atom/editor.coffee +++ b/src/atom/editor.coffee @@ -133,12 +133,7 @@ class Editor extends Template @cursor.bufferChanged(e) updateLineElement: (row) -> - line = @buffer.getLine(row) - element = @getLineElement(row) - if line == '' - element.html(' ') - else - element.text(line) + @getLineElement(row).replaceWith(@buildLineElement(row)) insertLineElement: (row) -> @getLineElement(row).before(@buildLineElement(row))