in ui/src/com/jediterm/terminal/ui/TerminalPanel.java [1214:1266]
void drawCursor(String c, Graphics2D gfx, TextStyle style) {
TerminalCursorState state = computeCursorState();
// hidden: do nothing
if (state == TerminalCursorState.HIDDEN) {
return;
}
final int x = getCoordX();
final int y = getCoordY();
// Outside bounds of window: do nothing
if (y < 0 || y >= myTermSize.getRows()) {
return;
}
CharBuffer buf = new CharBuffer(c);
int xCoord = x * myCharSize.width + getInsetX();
int yCoord = y * myCharSize.height;
int textLength = CharUtils.getTextLengthDoubleWidthAware(buf.getBuf(), buf.getStart(), buf.length(), mySettingsProvider.ambiguousCharsAreDoubleWidth());
int height = Math.min(myCharSize.height, getHeight() - yCoord);
int width = Math.min(textLength * TerminalPanel.this.myCharSize.width, TerminalPanel.this.getWidth() - xCoord);
int lineStrokeSize = 2;
java.awt.Color fgColor = getEffectiveForeground(style);
TextStyle inversedStyle = getInversedStyle(style);
java.awt.Color inverseBg = getEffectiveBackground(inversedStyle);
switch (getEffectiveShape()) {
case BLINK_BLOCK:
case STEADY_BLOCK:
if (state == TerminalCursorState.SHOWING) {
gfx.setColor(inverseBg);
gfx.fillRect(xCoord, yCoord, width, height);
drawCharacters(x, y, inversedStyle, buf, gfx);
} else {
gfx.setColor(fgColor);
gfx.drawRect(xCoord, yCoord, width, height);
}
break;
case BLINK_UNDERLINE:
case STEADY_UNDERLINE:
gfx.setColor(fgColor);
gfx.fillRect(xCoord, yCoord + height, width, lineStrokeSize);
break;
case BLINK_VERTICAL_BAR:
case STEADY_VERTICAL_BAR:
gfx.setColor(fgColor);
gfx.fillRect(xCoord, yCoord, lineStrokeSize, height);
break;
}
}