X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbackend%2FSwingTerminal.java;h=283d1ae141071590e903926994ed915074cb7365;hb=80b1b7b5fb2d8caed97ea9a98b8a844beb00927d;hp=a3825b852548c86bccf45817df32756da5ea729b;hpb=218d18dbda14a7bf482d6c07bed66f16bcd6a6ba;p=fanfix.git diff --git a/src/jexer/backend/SwingTerminal.java b/src/jexer/backend/SwingTerminal.java index a3825b8..283d1ae 100644 --- a/src/jexer/backend/SwingTerminal.java +++ b/src/jexer/backend/SwingTerminal.java @@ -117,7 +117,12 @@ public class SwingTerminal extends LogicalScreen /** * Use an outlined block for the cursor. */ - OUTLINE + OUTLINE, + + /** + * Use a vertical bar for the cursor. + */ + VERTICAL_BAR, } // ------------------------------------------------------------------------ @@ -648,6 +653,8 @@ public class SwingTerminal extends LogicalScreen cursorStyle = CursorStyle.OUTLINE; } else if (cursorStyleString.equals("block")) { cursorStyle = CursorStyle.BLOCK; + } else if (cursorStyleString.equals("verticalbar")) { + cursorStyle = CursorStyle.VERTICAL_BAR; } // Pull the system property for triple buffering. @@ -1180,7 +1187,7 @@ public class SwingTerminal extends LogicalScreen /* System.err.println("drawGlyph(): " + xPixel + " " + yPixel + " " + cell); - */ + */ BufferedImage image = null; if (cell.isBlink() && !cursorBlinkVisible) { @@ -1302,6 +1309,9 @@ public class SwingTerminal extends LogicalScreen case OUTLINE: gr.drawRect(xPixel, yPixel, cursorWidth - 1, textHeight - 1); break; + case VERTICAL_BAR: + gr.fillRect(xPixel, yPixel, 2, textHeight); + break; } } } @@ -1348,7 +1358,7 @@ public class SwingTerminal extends LogicalScreen if (bounds != null) { // Only update what is in the bounds xCellMin = textColumn(bounds.x); - xCellMax = textColumn(bounds.x + bounds.width); + xCellMax = textColumn(bounds.x + bounds.width) + 1; if (xCellMax > width) { xCellMax = width; } @@ -1359,7 +1369,7 @@ public class SwingTerminal extends LogicalScreen xCellMin = 0; } yCellMin = textRow(bounds.y); - yCellMax = textRow(bounds.y + bounds.height); + yCellMax = textRow(bounds.y + bounds.height) + 1; if (yCellMax > height) { yCellMax = height; } @@ -1381,7 +1391,7 @@ public class SwingTerminal extends LogicalScreen /* System.err.printf("bounds %s X %d %d Y %d %d\n", bounds, xCellMin, xCellMax, yCellMin, yCellMax); - */ + */ for (int y = yCellMin; y < yCellMax; y++) { for (int x = xCellMin; x < xCellMax; x++) { @@ -1828,6 +1838,7 @@ public class SwingTerminal extends LogicalScreen break; default: if (!alt && ctrl && !shift) { + // Control character, replace ch with 'A', 'B', etc. ch = KeyEvent.getKeyText(key.getKeyCode()).charAt(0); } // Not a special key, put it together