WebView: block cursor glyph becomes vertically misaligned after decreasing font size (C--)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- css, html, javascript
- Domain
- frontend
Research direction
Start with frontends/server/frontend/editor.js and compare the Canvas text path (drawText, textBaseline, and textOffsetY) with the .lem-cursor HTML text styling. Reproduce in the native WebView frontend by reducing the font size with C-- and checking block cursor alignment against adjacent text. Done when the cursor character stays aligned after font-size changes; the proposed canvas workaround is unverified, and no regression test is named.
Written by the indexing model from the issue text.
Description
Description
Thank you for Lem and the WebView frontend! I installed the package today
(October 4, 2026), and overall it is working very well. During this first
session, I noticed the following rendering issue.
In the native WebView frontend, reducing the font size with C-- makes
the character drawn inside the block cursor appear vertically displaced
relative to the buffer text. The editor otherwise works well.
I tested several buffers and consistently observed the same bug.
This appears to be a general WebView font-size alignment problem.
The screenshot I inspected happens to show an Org buffer; organ-mode is
not a reproduction requirement. Testing with a minimal configuration
remains pending.
Steps to reproduce
- Launch the native WebView frontend.
- Open a buffer containing text.
- Reduce the font size with
C--(Control + minus). - Move the block cursor onto a visible character.
- Compare the character inside the cursor with the adjacent text.
The exact number of font-size reductions and final font size were not recorded.
This uses Lem's font-size command, rather than browser page zoom.
Expected behavior
The character inside the block cursor remains aligned with the buffer's
text after font-size changes.
Actual behavior
The cursor's character appears lower than the surrounding text. In the
observed screenshot, the * inside the cursor appears between text lines.
Environment
- GNU Guix, Linux, X11, StumpWM.
- Lem revision:
ef6c48eb56575bb3ffe648c30846321b2a5d7e2f. - Native WebView frontend using GTK4 / WebKitGTK 6.0.
- Native webview library: 0.12.0.
- Font initially configured as
18px Monospace; reduced viaC--. - The screenshot buffer has organ-mode and transient-mode enabled; I
also observed the bug consistently in several other buffers. - Custom Guix package with local HTTP authentication and asset-path patches.
The initial screenshot predates the cursor-specific workaround described below.
Whether the latest running image includes that workaround has not been verified.
This report concerns the pinned revision above; reproduction on current
upstream HEAD has not been checked.
Screenshot observation
In an Org buffer, the character inside the block cursor at the beginning
of a heading appears below the heading text, toward the following line.
The Org heading is only an example of the general alignment symptom.
A screenshot is available locally, but is not attached to this report yet.
Investigation / possible cause
In frontends/server/frontend/editor.js, buffer text is rendered through
Canvas drawText, with textBaseline = 'top' and textOffsetY = 5.
The block cursor instead renders its character as HTML text in .lem-cursor,
using CSS font metrics and padding. These two rendering paths may produce
different vertical alignment as the font size changes.
This is a hypothesis, not a confirmed root cause.
A local workaround renders the cursor character in a small canvas using
the buffer's existing drawText function and devicePixelRatio. JavaScript
checks and the Guix build pass, but a visual font-size regression test of
that workaround is still pending. It should not yet be treated as a verified fix.
Possibly related report
Flashing Cursor placement is Incorrect with Lem Webview (on macos), #2251.
This Linux report may be additional evidence for that issue; whether the
underlying cause is the same has not been established.
- Dominant language
- Common Lisp
- Stars
- 3.1k
- Forks
- 261
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 133
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lem-project/lem
-
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
lem-project/lem#2525 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
lem-project/lem#2524 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
lem-project/lem#2488 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
lem-project/lem#2369 ·
Maintainers usually reply within 1 day
-
unix-paste-bugOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lem-project/lem#2360 ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug discord triage
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
storytold/craft-libs#5594 ·
Maintainers usually reply within 1 day