From 2a6b315d647401334353bc29cacda3ca14161a19 Mon Sep 17 00:00:00 2001 From: Ekaterina Tuzova Date: Fri, 9 Jun 2017 18:42:07 +0300 Subject: [PATCH] Jupyter: update scroll position accurately --- .../src/org/jetbrains/plugins/ipnb/editor/IpnbFileEditor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/IpnbFileEditor.java b/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/IpnbFileEditor.java index 2919ac5c0931..2421b6c98017 100644 --- a/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/IpnbFileEditor.java +++ b/python/ipnb/src/org/jetbrains/plugins/ipnb/editor/IpnbFileEditor.java @@ -277,10 +277,10 @@ public class IpnbFileEditor extends UserDataHolderBase implements FileEditor { final Rectangle cellBounds = ipnbPanel.getBounds(); final int shift = 2; - if (cellBounds.getY() <= rect.getY()) { + if (cellBounds.getY() <= rect.getY() || cellBounds.getY() >= rect.getY() + rect.height) { myScrollPane.getVerticalScrollBar().setValue(cellBounds.y - shift); } - if (cellBounds.getY() + cellBounds.getHeight() > rect.getY() + rect.getHeight()) { + if (cellBounds.getY() + cellBounds.getHeight() > rect.getY() + rect.getHeight() && cellBounds.height < rect.height) { myScrollPane.getVerticalScrollBar().setValue(cellBounds.y - rect.height + cellBounds.height + shift); } }