lint
[nikiroo-utils.git] / src / jexer / teditor / Highlighter.java
index 9576ad1e52b0b9ddd854a5693b64122873228373..44a2ed08c705a43584aaea1c0e22bd1ab1ff85c7 100644 (file)
@@ -3,7 +3,7 @@
  *
  * The MIT License (MIT)
  *
- * Copyright (C) 2017 Kevin Lamonte
+ * Copyright (C) 2019 Kevin Lamonte
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -39,11 +39,19 @@ import jexer.bits.Color;
  */
 public class Highlighter {
 
+    // ------------------------------------------------------------------------
+    // Variables --------------------------------------------------------------
+    // ------------------------------------------------------------------------
+
     /**
      * The highlighter colors.
      */
     private SortedMap<String, CellAttributes> colors;
 
+    // ------------------------------------------------------------------------
+    // Constructors -----------------------------------------------------------
+    // ------------------------------------------------------------------------
+
     /**
      * Public constructor sets the theme to the default.
      */
@@ -51,17 +59,23 @@ public class Highlighter {
         colors = new TreeMap<String, CellAttributes>();
     }
 
+    // ------------------------------------------------------------------------
+    // Highlighter ------------------------------------------------------------
+    // ------------------------------------------------------------------------
+
     /**
      * See if this is a character that should split a word.
      *
      * @param ch the character
      * @return true if the word should be split
      */
-    public boolean shouldSplit(final char ch) {
+    public boolean shouldSplit(final int ch) {
         // For now, split on punctuation
         String punctuation = "'\"\\<>{}[]!@#$%^&*();:.,-+/*?";
-        if (punctuation.indexOf(ch) != -1) {
-            return true;
+        if (ch < 0x100) {
+            if (punctuation.indexOf((char) ch) != -1) {
+                return true;
+            }
         }
         return false;
     }
@@ -73,7 +87,7 @@ public class Highlighter {
      * @return color associated with name, e.g. bold yellow on blue
      */
     public CellAttributes getColor(final String name) {
-        CellAttributes attr = (CellAttributes) colors.get(name);
+        CellAttributes attr = colors.get(name);
         return attr;
     }
 
@@ -129,5 +143,4 @@ public class Highlighter {
 
     }
 
-
 }