Skip to content

Commit

Permalink
Merge pull request #6 from v-yadli/dvhhVariant
Browse files Browse the repository at this point in the history
correctly display text under cursor in underdash/vertical line cursor mode
  • Loading branch information
dvhh authored Sep 5, 2016
2 parents 2ef5f57 + ee57c30 commit 5afd99d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,12 @@ private void drawCursorHelper(Canvas canvas, Path path, int mode, int shift) {
}
}

public void setCursorStyle(int cursorStyle)
{
public void setCursorStyle(int cursorStyle) {
mCursorStyle = cursorStyle;
}

public int getCursorStyle(){
return mCursorStyle;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ public void drawTextRun(Canvas canvas, float x, float y, int lineOffset,
canvas.drawText(text, index, countBeforeCursor, left, textOriginY, mTextPaint);
}
// Text at cursor
mTextPaint.setColor(mPalette[TextStyle.ciCursorForeground]);
// Only use invert color with BLOCK cursor.
// For underdash and vertical line, use normal color.
if(getCursorStyle() == 0) {
mTextPaint.setColor(mPalette[TextStyle.ciCursorForeground]);
}
canvas.drawText(text, cursorIndex, cursorIncr, cursorX,
textOriginY, mTextPaint);
// Text after cursor
Expand Down

0 comments on commit 5afd99d

Please sign in to comment.