From 2b16775db6b67e2187d8f2e00983736f1a9f1066 Mon Sep 17 00:00:00 2001 From: Andreas Billmann Date: Thu, 17 Dec 2015 22:57:26 +0100 Subject: [PATCH] scroll to the line before the selected error is, this helps recognizing the correct line --- src/main/java/ninja/javafx/smartcsv/fx/SmartCSVController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/ninja/javafx/smartcsv/fx/SmartCSVController.java b/src/main/java/ninja/javafx/smartcsv/fx/SmartCSVController.java index 53129e4..cb4110d 100644 --- a/src/main/java/ninja/javafx/smartcsv/fx/SmartCSVController.java +++ b/src/main/java/ninja/javafx/smartcsv/fx/SmartCSVController.java @@ -55,6 +55,7 @@ import java.io.File; import java.net.URL; import java.util.ResourceBundle; +import static java.lang.Math.max; import static javafx.application.Platform.runLater; /** @@ -270,7 +271,7 @@ public class SmartCSVController extends FXMLController { ValidationError entry = (ValidationError)errorList.getSelectionModel().getSelectedItem(); if (entry != null) { if (entry.getLineNumber() != null) { - tableView.scrollTo(entry.getLineNumber()); + tableView.scrollTo(max(0, entry.getLineNumber() - 1)); tableView.getSelectionModel().select(entry.getLineNumber()); } else { tableView.scrollTo(0);