From ccf73189eea81f3bcfb0ad9b9f61d5adcbc8bd35 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 30 Jun 2016 15:07:20 +0200 Subject: [PATCH] Allow scrollPastEnd to be updated in `TextEditor.prototype.update` --- spec/text-editor-spec.coffee | 3 ++- src/text-editor.coffee | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 4e38b7e16..a6363eab0 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -100,7 +100,7 @@ describe "TextEditor", -> editor.onDidChange(changeSpy = jasmine.createSpy('onDidChange')) editor.update({ tabLength: 6, softTabs: false, softWrapped: true, editorWidthInChars: 40, - ignoreInvisibles: true, mini: false, lineNumberGutterVisible: false + ignoreInvisibles: true, mini: false, lineNumberGutterVisible: false, scrollPastEnd: true }) expect(changeSpy.callCount).toBe(1) expect(editor.getTabLength()).toBe(6) @@ -110,6 +110,7 @@ describe "TextEditor", -> expect(editor.getInvisibles()).toEqual({}) expect(editor.isMini()).toBe(false) expect(editor.isLineNumberGutterVisible()).toBe(false) + expect(editor.getScrollPastEnd()).toBe(true) describe "config defaults", -> it "uses the `editor.tabLength`, `editor.softWrap`, and `editor.softTabs`, and `core.fileEncoding` config values", -> diff --git a/src/text-editor.coffee b/src/text-editor.coffee index d649bf136..05c938cd3 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -189,7 +189,7 @@ class TextEditor extends Model update: (params) -> { softTabs, tabLength, softWrapped, mini, placeholderText, lineNumberGutterVisible, - showInvisibles, ignoreInvisibles, editorWidthInChars + showInvisibles, ignoreInvisibles, editorWidthInChars, scrollPastEnd } = params resetDisplayLayer = false @@ -226,6 +226,9 @@ class TextEditor extends Model @setEditorWidthInChars(editorWidthInChars, false) resetDisplayLayer = true + if scrollPastEnd? and scrollPastEnd isnt @scrollPastEnd + @setScrollPastEnd(scrollPastEnd) + if resetDisplayLayer @resetDisplayLayer()