Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix line numbers alignment and change default padding to spaces. #488 #489

Merged
merged 2 commits into from
Apr 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.function.IntFunction;

import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.Background;
Expand All @@ -29,7 +30,7 @@ public class LineNumberFactory implements IntFunction<Node> {
new Background(new BackgroundFill(Color.web("#ddd"), null, null));

public static IntFunction<Node> get(GenericStyledArea<?, ?, ?> area) {
return get(area, digits -> "%0" + digits + "d");
return get(area, digits -> "%1$" + digits + "s");
}

public static IntFunction<Node> get(
Expand Down Expand Up @@ -57,6 +58,7 @@ public Node apply(int idx) {
lineNo.setBackground(DEFAULT_BACKGROUND);
lineNo.setTextFill(DEFAULT_TEXT_FILL);
lineNo.setPadding(DEFAULT_INSETS);
lineNo.setAlignment(Pos.TOP_RIGHT);
lineNo.getStyleClass().add("lineno");

// bind label's text to a Val that stops observing area's paragraphs
Expand Down