git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
#50 additional mouse pointer options
[fanfix.git]
/
src
/
jexer
/
backend
/
SwingTerminal.java
diff --git
a/src/jexer/backend/SwingTerminal.java
b/src/jexer/backend/SwingTerminal.java
index 134eceda63772cec5c776b9d0dedf323f4559bf3..283d1ae141071590e903926994ed915074cb7365 100644
(file)
--- 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.
*/
/**
* 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;
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.
}
// Pull the system property for triple buffering.
@@
-1180,7
+1187,7
@@
public class SwingTerminal extends LogicalScreen
/*
System.err.println("drawGlyph(): " + xPixel + " " + yPixel +
" " + cell);
/*
System.err.println("drawGlyph(): " + xPixel + " " + yPixel +
" " + cell);
- */
+
*/
BufferedImage image = null;
if (cell.isBlink() && !cursorBlinkVisible) {
BufferedImage image = null;
if (cell.isBlink() && !cursorBlinkVisible) {
@@
-1229,9
+1236,8
@@
public class SwingTerminal extends LogicalScreen
|| (cell.isBlink() && cursorBlinkVisible)
) {
gr2.setColor(attrToForegroundColor(cellColor));
|| (cell.isBlink() && cursorBlinkVisible)
) {
gr2.setColor(attrToForegroundColor(cellColor));
- char [] chars = new char[1];
- chars[0] = cell.getChar();
- gr2.drawChars(chars, 0, 1, gr2x + textAdjustX,
+ char [] chars = Character.toChars(cell.getChar());
+ gr2.drawChars(chars, 0, chars.length, gr2x + textAdjustX,
gr2y + textHeight - maxDescent + textAdjustY);
if (cell.isUnderline()) {
gr2y + textHeight - maxDescent + textAdjustY);
if (cell.isUnderline()) {
@@
-1303,6
+1309,9
@@
public class SwingTerminal extends LogicalScreen
case OUTLINE:
gr.drawRect(xPixel, yPixel, cursorWidth - 1, textHeight - 1);
break;
case OUTLINE:
gr.drawRect(xPixel, yPixel, cursorWidth - 1, textHeight - 1);
break;
+ case VERTICAL_BAR:
+ gr.fillRect(xPixel, yPixel, 2, textHeight);
+ break;
}
}
}
}
}
}
@@
-1349,7
+1358,7
@@
public class SwingTerminal extends LogicalScreen
if (bounds != null) {
// Only update what is in the bounds
xCellMin = textColumn(bounds.x);
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;
}
if (xCellMax > width) {
xCellMax = width;
}
@@
-1360,7
+1369,7
@@
public class SwingTerminal extends LogicalScreen
xCellMin = 0;
}
yCellMin = textRow(bounds.y);
xCellMin = 0;
}
yCellMin = textRow(bounds.y);
- yCellMax = textRow(bounds.y + bounds.height);
+ yCellMax = textRow(bounds.y + bounds.height)
+ 1
;
if (yCellMax > height) {
yCellMax = height;
}
if (yCellMax > height) {
yCellMax = height;
}
@@
-1382,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);
/*
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++) {
for (int y = yCellMin; y < yCellMax; y++) {
for (int x = xCellMin; x < xCellMax; x++) {
@@
-1829,6
+1838,7
@@
public class SwingTerminal extends LogicalScreen
break;
default:
if (!alt && ctrl && !shift) {
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
ch = KeyEvent.getKeyText(key.getKeyCode()).charAt(0);
}
// Not a special key, put it together