From e93d77a802d32a0e07a78a1eabef0aca9699d98d Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Mon, 9 Jan 2017 17:35:35 -0800 Subject: [PATCH] Make `positionCaret` package-private --- .../org/fxmisc/richtext/GenericStyledArea.java | 15 ++++----------- .../richtext/model/StyledTextAreaModel.java | 7 ++++++- .../fxmisc/richtext/model/TextEditingArea.java | 12 ------------ 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java b/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java index 47a6ffdd2..83e798faa 100644 --- a/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java +++ b/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java @@ -1121,17 +1121,6 @@ public void selectRange(int anchor, int caretPosition) { model.selectRange(anchor, caretPosition); } - /** - * {@inheritDoc} - * @deprecated You probably meant to use {@link #moveTo(int)}. This method will be made - * package-private in the future - */ - @Deprecated - @Override - public void positionCaret(int pos) { - model.positionCaret(pos); - } - /* ********************************************************************** * * * * Public API * @@ -1244,6 +1233,10 @@ public void dispose() { }; } + private void positionCaret(int pos) { + model.positionCaret(pos); + } + private ParagraphBox getCell(int index) { return virtualFlow.getCell(index).getNode(); } diff --git a/richtextfx/src/main/java/org/fxmisc/richtext/model/StyledTextAreaModel.java b/richtextfx/src/main/java/org/fxmisc/richtext/model/StyledTextAreaModel.java index a91b37018..9680195f3 100644 --- a/richtextfx/src/main/java/org/fxmisc/richtext/model/StyledTextAreaModel.java +++ b/richtextfx/src/main/java/org/fxmisc/richtext/model/StyledTextAreaModel.java @@ -657,7 +657,12 @@ public void selectRange(int anchor, int caretPosition) { } } - @Override + /** + * Positions only the caret. Doesn't move the anchor and doesn't change + * the selection. Can be used to achieve the special case of positioning + * the caret outside or inside the selection, as opposed to always being + * at the boundary. Use with care. + */ public void positionCaret(int pos) { try(Guard g = suspend(caretPosition, currentParagraph, caretColumn)) { internalCaretPosition.setValue(pos); diff --git a/richtextfx/src/main/java/org/fxmisc/richtext/model/TextEditingArea.java b/richtextfx/src/main/java/org/fxmisc/richtext/model/TextEditingArea.java index f252dca13..584107460 100644 --- a/richtextfx/src/main/java/org/fxmisc/richtext/model/TextEditingArea.java +++ b/richtextfx/src/main/java/org/fxmisc/richtext/model/TextEditingArea.java @@ -254,18 +254,6 @@ default void replace(IndexRange range, StyledDocument replacement) { replace(range.getStart(), range.getEnd(), replacement); } - /** - * Positions only the caret. Doesn't move the anchor and doesn't change - * the selection. Can be used to achieve the special case of positioning - * the caret outside or inside the selection, as opposed to always being - * at the boundary. Use with care. - * - * @deprecated You probably meant to use {@link NavigationActions#moveTo(int)}. This method will be made - * package-private in the future - */ - @Deprecated - public void positionCaret(int pos); - /** * Returns the absolute position (i.e. the spot in-between characters) to the left of the given column in the given paragraph. *