Fix code viewer editor when line numbers are enabled - #638
Open
DamienBraillard wants to merge 1 commit into
Open
Fix code viewer editor when line numbers are enabled#638DamienBraillard wants to merge 1 commit into
DamienBraillard wants to merge 1 commit into
Conversation
When `ShowLineNumbers` and `Editable` are both set to `true` on the `MudCodViewer`, there is a shift between the caret and the shown highlighted content. This is due to the fact that the `<pre>` overlay is shifted right by `3.8em` and the underlying `<textarea>` is not. So there is effectively a shift of 3.8em between the caret and the shown highlighted content. I encountered the issue in my project and it has also been reported in issue CodeBeamOrg#628. The fix adds a new style for the `<textarea>` and applies it dynamically when `ShowLineNumbers` is `true` (as it was already done for the `<pre>`) The 4th doc sample example has also been updated to allow enabling line numbers when in edit mode.
DamienBraillard
force-pushed
the
fix-code-editor-with-line-numbers
branch
from
August 14, 2026 13:38
b3b1ca6 to
3b2a5f0
Compare
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.
When
ShowLineNumbersandEditableare both set totrueon theMudCodViewer, there is a shift between the caret and the shown highlighted content.This is due to the fact that the
<pre>overlay is shifted right by3.8emand the underlying<textarea>is not. So there is effectively a shift of 3.8em between the caret and the shown highlighted content.I encountered the issue in my project and it has also been reported in issue #628.
The fix adds a new style for the
<textarea>and applies it dynamically whenShowLineNumbersistrue(as it was already done for the<pre>)The 4th doc sample example has also been updated to allow enabling line numbers when in edit mode.