From 687b6ddd87df483d10a12b9d29196732d5275b91 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Fri, 14 May 2021 16:45:57 +0200 Subject: [PATCH] Fix bug in scrolling the cursor into view Closes #6686 --- src/display/scrolling.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/display/scrolling.js b/src/display/scrolling.js index 75d6fc7ee4..27d6f70cda 100644 --- a/src/display/scrolling.js +++ b/src/display/scrolling.js @@ -39,8 +39,8 @@ export function scrollPosIntoView(cm, pos, end, margin) { // Set pos and end to the cursor positions around the character pos sticks to // If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch // If pos == Pos(_, 0, "before"), pos and end are unchanged - pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos + pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos } for (let limit = 0; limit < 5; limit++) { let changed = false