Webview vertically stretched text line spacing
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- javascript
- Domain
- frontend
Research direction
Start with frontends/server/frontend/editor.js, especially computeFontSize() and drawText(), and trace how the generated index.js is built since the report says edits to editor.js did not take effect. Compare the webview line spacing with the ncurses client using the same font, then verify that text lines no longer have excess vertical space and that redraws leave no artifacts.
Written by the indexing model from the issue text.
Description
In the webview client, extra vertical space is being added to every text line. The screenshot below illustrates this. The left hand side shows the webview client, and the right hand side shows the ncurses client in an iTerm2 window. Both use the same font (Menlo at 12 pt).
Despite not being a web dev - hence up-front apologies for any and all misinterpretations on my part! - I thought I'd give it a try; apparently hoping for some low hanging fruit. 😉
frontends/server/frontend/editor.js features the constant textOffsetY, which is used in two places:
computeFontSize()
Line 38 of frontends/server/frontend/editor.js reads:
Math.round(textMetrics.fontBoundingBoxAscent + textOffsetY + (textMetrics.emHeightDescent || 0)),
This seems more complicated that it might perhaps need top be?
Why was using the bounding box not sufficient?
Math.round(textMetrics.fontBoundingBoxAscent + textMetrics.fontBoundingBoxDescent),
drawText()
Line 48 of frontends/server/frontend/editor.js reads:
y += Math.round(textOffsetY); // 少しずらしておかないと上の部分が現在行からはみ出して、その行だけ再描画しても描画跡が残ってしまう
The Japanese comment seems to say something along the lines of "if we don't move it, bad things will happen". I would presume this comment was addede by @cxxxr, the author of the commit introducing the code? I would also presume that the issue trying to be remediated here occurs when using CJK fonts?
I modified editor.js, and rebuilt lem, but my changes didn't take effect. It seems I would somehow need to regenerate index.js? How would I do that?
Many thanks in advance, and looking forward to your thoughts!
- 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