Add 'src/jexer/' from commit 'cf01c92f5809a0732409e280fb0f32f27393618d'
[fanfix.git] / src / jexer / teditor / Line.java
index f3168fdff2d22ff49c4924a6ba3d937e3c081ef7..7cd5febabee8462f6c51bc66e886903795aff698 100644 (file)
@@ -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.
      *