mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Lines remain syntax-highlighted when they are updated.
This commit is contained in:
@@ -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 ->
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user