Editor handles changes to wrapped lines.

This commit is contained in:
Nathan Sobo
2012-02-10 11:15:57 -07:00
parent 9fef75cb5f
commit ea4f122e19
2 changed files with 9 additions and 1 deletions

View File

@@ -67,6 +67,14 @@ describe "Editor", ->
editor.cursor.setPosition([4, 0])
expect(editor.cursor.position()).toEqual(editor.lines.find('pre:eq(5)').position())
# Many more tests for change events in the LineWrapper spec
it "handles changes to wrapped lines correctly", ->
buffer.insert([6, 28], '1234567')
expect(editor.lines.find('.line:eq(7)').text()).toBe ' current < pivot ? left1234567.push(current) '
expect(editor.lines.find('.line:eq(8)').text()).toBe ': right.push(current);'
expect(editor.lines.find('.line:eq(9)').text()).toBe ' }'
describe "cursor movement", ->
describe ".setCursorPosition({row, column})", ->
beforeEach ->

View File

@@ -139,7 +139,7 @@ class Editor extends View
@buffer.on 'change', (e) =>
@cursor.bufferChanged(e)
@highlighter.on 'change', (e) =>
@lineWrapper.on 'change', (e) =>
{ oldRange, newRange } = e
if newRange.end.row > oldRange.end.row