From 02ab7179ce553658a60719a7f9ca4cc2c8a8cf49 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 14 Dec 2015 16:56:53 -0800 Subject: [PATCH 1/4] Emit state update when model's scroll position is changed --- spec/text-editor-presenter-spec.coffee | 5 +++++ src/text-editor-presenter.coffee | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/text-editor-presenter-spec.coffee b/spec/text-editor-presenter-spec.coffee index effa579b1..2d5a37886 100644 --- a/spec/text-editor-presenter-spec.coffee +++ b/spec/text-editor-presenter-spec.coffee @@ -807,6 +807,11 @@ describe "TextEditorPresenter", -> getState(presenter) # commits scroll position expect(editor.getFirstVisibleScreenRow()).toBe 6 + it "updates when the model's scroll position is changed directly", -> + presenter = buildPresenter(scrollTop: 0, explicitHeight: 20, horizontalScrollbarHeight: 10, lineHeight: 10) + expectStateUpdate presenter, -> editor.setFirstVisibleScreenRow(1) + expect(getState(presenter).content.scrollTop).toBe 10 + it "reassigns the scrollTop if it exceeds the max possible value after lines are removed", -> presenter = buildPresenter(scrollTop: 80, lineHeight: 10, explicitHeight: 50, horizontalScrollbarHeight: 0) expect(getState(presenter).content.scrollTop).toBe(80) diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index 5cfaeebcf..a613ee403 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -1447,7 +1447,7 @@ class TextEditorPresenter @emitDidUpdateState() didChangeFirstVisibleScreenRow: (screenRow) -> - @updateScrollTop(screenRow * @lineHeight) + @setScrollTop(screenRow * @lineHeight) getVerticalScrollMarginInPixels: -> Math.round(@model.getVerticalScrollMargin() * @lineHeight) From c7bff1aec5335aa3e446d13671844f7998a27b52 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Fri, 11 Dec 2015 18:07:13 -0800 Subject: [PATCH 2/4] :memo: Add tip about Keybinding Resolver to keymap.cson --- dot-atom/keymap.cson | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dot-atom/keymap.cson b/dot-atom/keymap.cson index cc8a8228e..2e8b0e0ab 100644 --- a/dot-atom/keymap.cson +++ b/dot-atom/keymap.cson @@ -21,7 +21,12 @@ # * https://atom.io/docs/latest/using-atom-basic-customization#customizing-key-bindings # * https://atom.io/docs/latest/behind-atom-keymaps-in-depth # +# If you're having trouble with your keybindings not working, try the +# Keybinding Resolver: Cmd+. on OS X and Ctrl+. on other platforms. See the +# Debugging Guide for more information: +# * https://atom.io/docs/v1.3.1/hacking-atom-debugging#check-the-keybindings +# # This file uses CoffeeScript Object Notation (CSON). -# If you are unfamiliar with CSON, you can read more about it in the +# If you are unfamiliar with CSON, you can read more about it in the # Atom Flight Manual: # https://atom.io/docs/latest/using-atom-basic-customization#cson From 5ab2594c0e348390a4e9d5d11597cf09ac9ebb98 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Fri, 11 Dec 2015 18:47:48 -0800 Subject: [PATCH 3/4] :memo: Point to the latest documentation --- dot-atom/keymap.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dot-atom/keymap.cson b/dot-atom/keymap.cson index 2e8b0e0ab..5b32a993a 100644 --- a/dot-atom/keymap.cson +++ b/dot-atom/keymap.cson @@ -24,7 +24,7 @@ # If you're having trouble with your keybindings not working, try the # Keybinding Resolver: Cmd+. on OS X and Ctrl+. on other platforms. See the # Debugging Guide for more information: -# * https://atom.io/docs/v1.3.1/hacking-atom-debugging#check-the-keybindings +# * https://atom.io/docs/latest/hacking-atom-debugging#check-the-keybindings # # This file uses CoffeeScript Object Notation (CSON). # If you are unfamiliar with CSON, you can read more about it in the From 56e93c64da47cfec4163a798ba21ad26c2c04045 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Mon, 14 Dec 2015 17:52:21 -0800 Subject: [PATCH 4/4] :memo: Add backticks around keybindings --- dot-atom/keymap.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dot-atom/keymap.cson b/dot-atom/keymap.cson index 5b32a993a..10ad345d4 100644 --- a/dot-atom/keymap.cson +++ b/dot-atom/keymap.cson @@ -22,7 +22,7 @@ # * https://atom.io/docs/latest/behind-atom-keymaps-in-depth # # If you're having trouble with your keybindings not working, try the -# Keybinding Resolver: Cmd+. on OS X and Ctrl+. on other platforms. See the +# Keybinding Resolver: `Cmd+.` on OS X and `Ctrl+.` on other platforms. See the # Debugging Guide for more information: # * https://atom.io/docs/latest/hacking-atom-debugging#check-the-keybindings #