wrap up TODOs
authorKevin Lamonte <kevin.lamonte@gmail.com>
Sun, 3 Nov 2019 03:46:43 +0000 (22:46 -0500)
committerKevin Lamonte <kevin.lamonte@gmail.com>
Sun, 3 Nov 2019 03:46:43 +0000 (22:46 -0500)
src/jexer/TSplitPane.java
src/jexer/teditor/Document.java

index 7c85278f88d0d6df3ff34f01064e2be57d25481d..b771dd1c8beeaf84065ca8e8637be1a93fd37197 100644 (file)
@@ -225,7 +225,28 @@ public class TSplitPane extends TWidget {
         CellAttributes attr = getTheme().getColor("tsplitpane");
         if (vertical) {
             vLineXY(split, 0, getHeight(), GraphicsChars.WINDOW_SIDE, attr);
-            // TODO: draw intersections of children
+
+            // Draw intersections of children
+            if ((left instanceof TSplitPane)
+                && (((TSplitPane) left).vertical == false)
+                && (right instanceof TSplitPane)
+                && (((TSplitPane) right).vertical == false)
+                && (((TSplitPane) left).split == ((TSplitPane) right).split)
+            ) {
+                putCharXY(split, ((TSplitPane) left).split, '\u253C', attr);
+            } else {
+                if ((left instanceof TSplitPane)
+                    && (((TSplitPane) left).vertical == false)
+                ) {
+                    putCharXY(split, ((TSplitPane) left).split, '\u2524', attr);
+                }
+                if ((right instanceof TSplitPane)
+                    && (((TSplitPane) right).vertical == false)
+                ) {
+                    putCharXY(split, ((TSplitPane) right).split, '\u251C',
+                        attr);
+                }
+            }
 
             if ((mouse != null)
                 && (mouse.getAbsoluteX() == getAbsoluteX() + split)
@@ -237,7 +258,28 @@ public class TSplitPane extends TWidget {
             }
         } else {
             hLineXY(0, split, getWidth(), GraphicsChars.SINGLE_BAR, attr);
-            // TODO: draw intersections of children
+
+            // Draw intersections of children
+            if ((top instanceof TSplitPane)
+                && (((TSplitPane) top).vertical == true)
+                && (bottom instanceof TSplitPane)
+                && (((TSplitPane) bottom).vertical == true)
+                && (((TSplitPane) top).split == ((TSplitPane) bottom).split)
+            ) {
+                putCharXY(((TSplitPane) top).split, split, '\u253C', attr);
+            } else {
+                if ((top instanceof TSplitPane)
+                    && (((TSplitPane) top).vertical == true)
+                ) {
+                    putCharXY(((TSplitPane) top).split, split, '\u2534', attr);
+                }
+                if ((bottom instanceof TSplitPane)
+                    && (((TSplitPane) bottom).vertical == true)
+                ) {
+                    putCharXY(((TSplitPane) bottom).split, split, '\u252C',
+                        attr);
+                }
+            }
 
             if ((mouse != null)
                 && (mouse.getAbsoluteY() == getAbsoluteY() + split)
@@ -595,7 +637,7 @@ public class TSplitPane extends TWidget {
             keep.onResize(new TResizeEvent(TResizeEvent.Type.WIDGET, getWidth(),
                     getHeight()));
         }
-        
+
         return keep;
     }
 
index ffbe0816bd1e80b2c4639e7253b8b4dc3f50b8eb..a9979f5a17d4a375197dac4bb7b09e3bcd405060 100644 (file)
@@ -89,7 +89,8 @@ public class Document {
     public Document(final String str, final CellAttributes defaultColor) {
         this.defaultColor = defaultColor;
 
-        // TODO: set different colors based on file extension
+        // Set colors to resemble the Borland IDE colors, but for Java
+        // language keywords.
         highlighter.setJavaColors();
 
         String [] rawLines = str.split("\n");