Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions core/src/main/java/io/github/rosemoe/sora/widget/CodeEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,12 @@ void drawInlay(Canvas canvas, Inlay inlay) {
currentCharWidth = measureText(lineContent, inlay.column, 1, inlay.line);
}
float inlayStartX = charX + currentCharWidth;
float baselineY = charY + getRowBaseline(0);

float verticalPadding = getDpUnit() * 1;
Paint.FontMetrics fm = mPaintGraph.getFontMetrics();
float textHeight = fm.descent - fm.ascent;
float baselineY = charY - (textHeight / 2) - verticalPadding * 2;

Paint.Style oldStyle = mPaintGraph.getStyle();
float oldTextSize = mPaintGraph.getTextSize();
Typeface oldTypeface = mPaintGraph.getTypeface();
Expand All @@ -535,10 +540,8 @@ void drawInlay(Canvas canvas, Inlay inlay) {
mPaintGraph.setTextSize(mPaint.getTextSize() * 0.85f);
mPaintGraph.setTypeface(getTypefaceText());
float textWidth = mPaintGraph.measureText(inlay.text);
Paint.FontMetrics fm = mPaintGraph.getFontMetrics();
float textHeight = fm.descent - fm.ascent;

float horizontalPadding = getDpUnit() * 4;
float verticalPadding = getDpUnit() * 1;
float marginFromChar = getDpUnit() * 2;
float bgWidth = textWidth + horizontalPadding * 2;
float bgHeight = textHeight + verticalPadding * 2;
Expand Down