fix(core): fixed-width tabs with reliable caret coords - #123
Draft
jsimonrichard wants to merge 7 commits into
Draft
fix(core): fixed-width tabs with reliable caret coords#123jsimonrichard wants to merge 7 commits into
jsimonrichard wants to merge 7 commits into
Conversation
🦋 Changeset detectedLatest commit: 628ddef The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@prosemark/core
@prosemark/latex
@prosemark/paste-rich-text
@prosemark/render-html
@prosemark/spellcheck-frontend
@prosemark/vscode-extension-integrator
commit: |
Deploying prosemark with
|
| Latest commit: |
628ddef
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://62b788d3.prosemark.pages.dev |
| Branch Preview URL: | https://cursor-fixed-tab-widget-curs.prosemark.pages.dev |
Empty inline-block tabs used the baseline box model and stretched the line, so coordsAtPos reported a taller rect when the cursor followed a tab. Align like cm-widgetBuffer and set height to 1em. Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
CodeMirror's visual char motion can skip the document index of a replaced tab. Run a Prec.high keymap that steps across tab code units in logical forward/backward order (matching default ArrowLeft/Right) before the default keymap handles the key. Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
Decoration.replace removes tabs from the text layout tree, so moveVisually never steps through them. Use Decoration.mark with a fixed-width transparent span so the \t remains in the line string, arrow keys need no override, and soft-indent pixel width stays stable. Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
Mark + overflow:hidden left the tab glyph's client rects outside the box, so coordsAtPos got left==right and the overlay caret vanished. Use replace widget with literal tab, fixed px width from char width, and WidgetType.coordsAt on box edges; refresh on geometryChanged. Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
coordsInWidget passes pos=0/1 for ends of replaced range; using the document side argument picked the wrong edge and broke drawSelection. Clamp tall rects like Placeholder.coordsAt. Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
cursor
Bot
force-pushed
the
cursor/fixed-tab-widget-cursor-height-47f0
branch
from
April 12, 2026 01:34
42f5fc9 to
f93b3a8
Compare
Similar layout to debug-vsc-extn-in-web but without VS Code flows, spellcheck, latex, or render-html. Includes drawSelection and tab fixture buttons for reproducing caret/coords issues. Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
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.
Summary
Disappearing caret (mark +
overflow: hidden)A
Decoration.markaround\twith a narrowerinline-blockandoverflow: hiddenstill lays out the tab using native tab stops. The text node’sgetClientRects()can end up outside the clipped box.EditorView.coordsAtPosthen seesleft === right, bails out, anddrawSelectiondraws a zero-width caret — it looks like the cursor vanished.Fix
Go back to
Decoration.replace, but the widget DOM is a span that still contains a literal\t(like CodeMirror’s ownTabWidgetinhighlightSpecialChars). That keepsmoveVisually/ default arrow keys working without a custom keymap.TAB_WIDTH_CH * defaultCharacterWidth / scaleXin pixels (recomputed ongeometryChangedand viaupdateDOM).WidgetType.coordsAtto return the left or right edge of the box (zero-width caret segment), sodrawSelectionnever depends on clipped glyph rects.color: transparent,caret-color: currentColor,overflow: hidden,vertical-align/heightas before.Changeset
.changeset/fixed-tab-cursor-height.md—@prosemark/core(patch).