X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fteditor%2FLine.java;h=7cd5febabee8462f6c51bc66e886903795aff698;hb=12b90437b5f22c2ae6e9b9b14c3b62b60f6143e5;hp=f3168fdff2d22ff49c4924a6ba3d937e3c081ef7;hpb=39e863978f5c6de901b05b3ecfaee18aa934663d;p=fanfix.git diff --git a/src/jexer/teditor/Line.java b/src/jexer/teditor/Line.java index f3168fd..7cd5feb 100644 --- a/src/jexer/teditor/Line.java +++ b/src/jexer/teditor/Line.java @@ -155,6 +155,18 @@ public class Line { position = screenToTextPosition(screenPosition); } + /** + * Get the character at the current cursor position in the text. + * + * @return the character, or -1 if the cursor is at the end of the line + */ + public int getChar() { + if (position == rawText.length()) { + return -1; + } + return rawText.codePointAt(position); + } + /** * Get the on-screen display length. *