Add needsUpdate and needsAutoscroll properties to cursor views

Then in the editor, we update and autoscroll only the views that need it. Autoscrolling is suppressed when resetting the display so that we honor the scroll positions of the active EditSession.
This commit is contained in:
Corey Johnson & Nathan Sobo
2012-11-13 17:01:12 -07:00
parent ee233d56a7
commit cef9ce6ca7
3 changed files with 44 additions and 35 deletions

View File

@@ -659,13 +659,11 @@ describe "Editor", ->
it "places an additional cursor", ->
editor.attachToDom()
setEditorHeightInLines(editor, 5)
editor.renderedLines.trigger mousedownEvent(editor: editor, point: [3, 0])
editor.setCursorBufferPosition([3, 0])
editor.scrollTop(editor.lineHeight * 6)
spyOn(editor, "scrollTo").andCallThrough()
editor.renderedLines.trigger mousedownEvent(editor: editor, point: [6, 0], metaKey: true)
expect(editor.scrollTo.callCount).toBe 1
expect(editor.scrollTop()).toBe editor.lineHeight * (6 - editor.vScrollMargin)
[cursor1, cursor2] = editor.getCursorViews()
expect(cursor1.position()).toEqual(top: 3 * editor.lineHeight, left: 0)