Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[cursor] Fix cursor position, size and fill color
Render cursor full-size instead of half-size with offset.
  • Loading branch information
Thomas Perl committed Sep 25, 2013
1 parent 28b2ba2 commit 9b0f336
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions textrender.cpp
Expand Up @@ -92,11 +92,11 @@ void TextRender::paint(QPainter* painter)

// cursor
if (iTerm->showCursor()) {
painter->setOpacity(1.0);
painter->setOpacity(0.5);
QPoint cursor = cursorPixelPos();
QSize csize = cursorPixelSize();
painter->setPen( iColorTable[Terminal::defaultFgColor] );
painter->setBrush(Qt::transparent);
painter->setPen(Qt::transparent);
painter->setBrush(iColorTable[Terminal::defaultFgColor]);
painter->drawRect(cursor.x(), cursor.y(), csize.width(), csize.height());
}

Expand Down Expand Up @@ -295,10 +295,7 @@ void TextRender::setFontPointSize(int psize)

QPoint TextRender::cursorPixelPos()
{
QPoint ret = charsToPixels(iTerm->cursorPos());
ret.rx() += 2;
ret.ry() += iFontHeight/2;
return ret;
return charsToPixels(iTerm->cursorPos());
}

QPoint TextRender::charsToPixels(QPoint pos)
Expand All @@ -309,5 +306,5 @@ QPoint TextRender::charsToPixels(QPoint pos)

QSize TextRender::cursorPixelSize()
{
return (QSize(iFontWidth, iFontHeight/2));
return (QSize(iFontWidth, iFontHeight));
}

0 comments on commit 9b0f336

Please sign in to comment.