From 3651f79b401104061433076ea0dadaa2e2d5ca14 Mon Sep 17 00:00:00 2001 From: "dmitriy.tseyler" Date: Thu, 29 Sep 2016 18:44:41 +0300 Subject: [PATCH] DBE-3186 delete row scrolls grid view to very last column --- platform/util/src/com/intellij/ui/JBAutoscroller.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/util/src/com/intellij/ui/JBAutoscroller.java b/platform/util/src/com/intellij/ui/JBAutoscroller.java index e5d6298e369d..5b27f889c0e0 100644 --- a/platform/util/src/com/intellij/ui/JBAutoscroller.java +++ b/platform/util/src/com/intellij/ui/JBAutoscroller.java @@ -304,9 +304,9 @@ public class JBAutoscroller implements ActionListener { int row = getLeadSelectionIndexIfSelectionIsNotEmpty(getRowSelectionModel()); int col = getLeadSelectionIndexIfSelectionIsNotEmpty(getColumnSelectionModel()); - if (row >= 0 && row < myTable.getRowCount() || col >= 0 && col < myTable.getColumnCount()) { - myTable.scrollRectToVisible(myTable.getCellRect(row, col, false)); - } + boolean validRow = (row >= 0 || myTable.getRowCount() == 0) && row < myTable.getRowCount(); + boolean validCol = (col >= 0 || myTable.getColumnCount() == 0) && col < myTable.getColumnCount(); + if (validRow && validCol) myTable.scrollRectToVisible(myTable.getCellRect(row, col, false)); } private boolean locked() {