Lines remain syntax-highlighted when they are updated.

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-02-02 17:04:37 -07:00
parent 71e5462611
commit 0120df540a
2 changed files with 7 additions and 6 deletions

View File

@@ -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 ->

View File

@@ -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))