From a43a8b0d12ec4f13c304f95875e2a55208f41da3 Mon Sep 17 00:00:00 2001 From: jocs Date: Sun, 3 Nov 2019 10:44:15 +0800 Subject: [PATCH] remove magic number --- src/renderer/components/editorWithTabs/editor.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/editorWithTabs/editor.vue b/src/renderer/components/editorWithTabs/editor.vue index 0cd0c372..656e262a 100644 --- a/src/renderer/components/editorWithTabs/editor.vue +++ b/src/renderer/components/editorWithTabs/editor.vue @@ -603,8 +603,9 @@ export default { // Used to fix #628: auto scroll cursor to visible if the cursor is too low. if (container.clientHeight - y < 100) { - // 740 is the lowest cursor position(till to top) that editor allowed. - animatedScrollTo(container, container.scrollTop + (y - 740), 0) + // editableHeight is the lowest cursor position(till to top) that editor allowed. + const editableHeight = container.clientHeight - 100 + animatedScrollTo(container, container.scrollTop + (y - editableHeight), 0) } this.selectionChange = changes