mirror of
https://github.com/frosch95/SmartCSV.fx.git
synced 2026-04-11 13:38:23 +02:00
scroll to the line before the selected error is, this helps recognizing the correct line
This commit is contained in:
@@ -55,6 +55,7 @@ import java.io.File;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import static java.lang.Math.max;
|
||||||
import static javafx.application.Platform.runLater;
|
import static javafx.application.Platform.runLater;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -270,7 +271,7 @@ public class SmartCSVController extends FXMLController {
|
|||||||
ValidationError entry = (ValidationError)errorList.getSelectionModel().getSelectedItem();
|
ValidationError entry = (ValidationError)errorList.getSelectionModel().getSelectedItem();
|
||||||
if (entry != null) {
|
if (entry != null) {
|
||||||
if (entry.getLineNumber() != null) {
|
if (entry.getLineNumber() != null) {
|
||||||
tableView.scrollTo(entry.getLineNumber());
|
tableView.scrollTo(max(0, entry.getLineNumber() - 1));
|
||||||
tableView.getSelectionModel().select(entry.getLineNumber());
|
tableView.getSelectionModel().select(entry.getLineNumber());
|
||||||
} else {
|
} else {
|
||||||
tableView.scrollTo(0);
|
tableView.scrollTo(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user