input_code_editor(): fix caret drift caused by prism theme font-family override#1304
Merged
input_code_editor(): fix caret drift caused by prism theme font-family override#1304
Conversation
Collaborator
|
Looks like 7c3b7d3 undid the intended fix, maybe since it's a "distributed file"? |
elnelson575
reviewed
Apr 28, 2026
…ret drift Prism themes hardcode `font-family` directly on `.prism-code-editor`, which wins over bslib's monospace font override and causes the caret to visually drift from the actual insertion point. Closes #1303
720e12e to
7ae18b9
Compare
cpsievert
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1303
Summary
Prism Code Editor themes (e.g.
prism-okaidia) hardcode afont-familydeclaration directly on.prism-code-editor. Because bslib'scode-editor.cssonly setfont-familyonbslib-code-editor .code-editorand itstextarea/pre/codechildren — not on.prism-code-editoritself — the theme's font won the cascade and caused the caret to visually drift to the right of the actual text insertion point.The fix adds
.prism-code-editorto the existing font selector ininst/components/dist/code-editor.css, ensuring bslib's monospace font overrides whatever the theme injects.Verification
Open
input_code_editor()with any non-default theme and type a long line of code. The caret should stay visually aligned with the insertion point throughout.