Skip to content

Commit 332b6ad

Browse files
committed
fix(editor): draw inline ghost text in content coordinates
1 parent 0234c9a commit 332b6ad

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎editor/src/main/java/com/itsaky/androidide/editor/ui/GhostTextRenderer.kt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ class GhostTextRenderer(private val editor: CodeEditor) : EditorRenderer(editor)
8484
// Mid-grey at ~50% alpha reads as "ghost" on both light and dark themes.
8585
ghostPaint.color = GHOST_COLOR
8686

87-
val x = editor.getCharOffsetX(line, column)
88-
// getCharOffsetY returns the (screen) bottom of the row; sit the text on that baseline.
89-
val baseline = editor.getCharOffsetY(line, column) - ghostPaint.descent()
87+
val x = editor.getCharOffsetX(line, column) + editor.offsetX
88+
// getRowBaseline is the exact baseline sora draws its own text at (content space).
89+
val baseline = editor.getRowBaseline(line).toFloat()
9090
// Ghost text is single-line: only draw up to the first newline.
9191
canvas.drawText(text.substringBefore('\n'), x, baseline, ghostPaint)
9292
} catch (_: Throwable) {

0 commit comments

Comments
 (0)