Repository navigation
Keep the editor's code clear of Jim's stage - #791
Merged
Merged
Conversation
EnjouWang
force-pushed
the
reserve-jim-stage-in-editor
branch
from
November 20, 2026 19:55
7d26ed9 to
7064858
Compare
EnjouWang
force-pushed
the
reserve-jim-stage-in-editor
branch
from
November 20, 2026 20:23
7064858 to
2557339
Compare
matthiola0
reviewed
Nov 21, 2026
matthiola0
left a comment
Contributor
There was a problem hiding this comment.
Tested 25573393 on Windows 11 with Node.js v22.23.1 and Chromium.
node --test --test-name-pattern="clear of Jim's stage|reserves none of its width|strip beside Jim" tests/browser/interview-layout.test.jsAll 8 tests passed at the PR head and after each change below. With the proposed assertions:
const bottom = falsefails the two 1100 px cases that reserve space at the bottom.JIM_STAGE_EDITOR_GAP_PX = 0fails the four cases that reserve space beside the stage.
EnjouWang
force-pushed
the
reserve-jim-stage-in-editor
branch
from
November 21, 2026 13:38
2557339 to
16165b3
Compare
EnjouWang
force-pushed
the
reserve-jim-stage-in-editor
branch
from
November 21, 2026 14:36
16165b3 to
22e01d2
Compare
1 task done
Jim's stage floats over the editor, and the editor did not know it was there: at 1366 px the end of a long line, and the caret typing past column 95, scrolled to the textarea's edge under the stage, and the last rows could not be scrolled out from under the compact card. The stage's placement now also tells the editor what it covers, and the editor keeps the cheaper side out of its scroll range. Beside the stage that is a transparent right border, since a textarea leaves its right padding out of that range and a narrower box would not take a click beside the code; in forced colors the border is Canvas, a system color they keep, so the strip does not paint as a solid bar. Under a compact card it is the bottom, measured with the page and the panel unscrolled so scrolling never leaves it short, with scroll-padding keeping the caret above the card. A card grown down most of the editor takes the width instead. One over half the editor's width never takes the width. In the desktop shell, one window tall from 1024 px up, it always takes the bottom, only room to scroll in a panel that scrolls itself; below that, where the page scrolls the editor, as on a phone, the self-view alone kept the last row and the caret typing on it under the card with the page scrolled to its end, so there it takes neither side and the page gets room past its end as tall as what the card covers of the window, and scroll padding as tall, so it scrolls them clear. Close sysprog21#512 Change-Id: I1556b4a21ef34bf8b4f4a972531e0c635ae4b320
EnjouWang
force-pushed
the
reserve-jim-stage-in-editor
branch
from
November 21, 2026 15:03
22e01d2 to
ca7b8ec
Compare
Contributor
|
Thank @EnjouWang for contributing! |
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.
Jim's stage floats over the editor, and the editor did not know it was there. At 1366x900 the end of a line longer than about 95 columns, and the caret typing there, scrolled to the textarea's right edge at x 1349, under the stage that starts at x 1174; at 1100x800 the last rows could not be scrolled out from under the compact card. As accepted in #512, this keeps the floating stage, the captions, the self-view and the shell layout as they are and changes only the editor's scroll range.
placeJimStageBelowToolbar()already observes the stage. It now also passes the stage, measured after.scrollableis settled, toreserveJimStageInEditor(), and observes the editor stack, since the test drawer's splitter moves the editor under the card without resizing the window or the stage.reserveJimStageInEditor()writes one of two reservations to the editor stack, whichever costs the editor less:--jim-stage-reserve-right, the width beside the stage plus a 6 px gap, or--jim-stage-reserve-bottom, the overlap of a compact card at the bottom.Beside the stage the reservation is a transparent right border on
#editorand#editor-highlight, not the right padding #512 proposed. Chromium leaves a textarea's right padding out of its scroll range: with 191 px of right padding the end of a long line still scrolled to x 1349.6. A narrower box would scroll correctly but leaves the strip beside the code outside the textarea, so a click there blurred the editor; a border still takes that click. In forced colors the border isCanvas: a transparent border is forced toCanvasTextand painted the whole strip black, while a system color the author sets is kept, so the text and token colors stay forced. Under a compact card both text layers and the gutter pad their bottom instead, andscroll-padding-bottomkeeps the caret above the card while typing, because the card grows with the captions and a border there would resize the text area while Jim speaks.The bottom overlap is measured at rest,
editor.bottom + window.scrollY + panel.scrollTop - stage.top, as the toolbar anchor is: scrolling only moves the editor up from under the fixed card, so the overlap at rest is the most it can be and the reserve does not depend on where the page or the panel is scrolled. The right reserve reads only horizontal positions. Comparing the two fractions keeps the cheap bottom reserve for the usual compact card (14 px of a 512 px editor at 1100x800, against 39% of its width) and takes the width when a long caption and the self-view grow the card down most of the editor (98% of its height at 1100x600). Below 1024 px the sidebar stacks above the editor and the page scrolls; the right reserve now covers those widths as well (1023x700, 1000x700, 900x800 and 800x900 all left the row beside the card under it before). A card over half the editor's width never takes the width. In the desktop shell, one window tall from 1024 px up, it always takes the bottom, as beside the widest sidebar (a 500 px editor at 1100x800 gets the same 14 px bottom reserve as the default one): with the width ruled out, the bottom is only room to scroll in a panel that scrolls itself, so it hides no row the card does not already cover, and no cost comparison is needed. Below 1024 px, where the page, not the editor, scrolls the code, it takes neither side.There, as on a phone, the self-view alone made the compact card taller than the room the page had below the editor: at 480x800, 390x844, 360x640 and 412x915, with the page and the editor scrolled to their end, the last row stayed under the card, and so did the caret typed on it. A long caption can cover all of the editor's visible box (at 390x844 the editor spans y 408 to 650 and the card starts at y 383), so no reserve inside the editor can show those rows. Such a card therefore reserves nothing in the editor, and
--jim-stage-reserve-pageon the root, what the card covers of the window plus the gap, becomes the page'spadding-bottomandscroll-padding-bottom, as the lobby'sscroll-padding-bottomalready keeps controls clear of its update notice. Across those four sizes, with the self-view on or off and no, a short, a medium or a full caption, no last row is under the card with the page scrolled to its end (24 of 32 were before), and the caret typed on the last row ends above the card in all 16 runs with the self-view. A stage that does not fit in the window where it floats is.scrollableand scrolls with the page under the toolbar, so it adds no room: its position in the window would make the page's length depend on where the page was scrolled. Only below 1024 px does a card get this room: from 1024 px up the page is one window tall and its panel scrolls the code, and with the room the widest sidebar at 1100x800 made the page 1000 px long and typing on the last rows scrolled the whole shell. Beside the widest sidebar, a card grown down most of the editor now takes the bottom too: at 1100x600 and 1024x768 with the self-view and a long caption the last row reserved nothing at 2557339 and 22e01d2 and ended under the card, and now ends above it with a 281 px reserve. Only where the card covers all but about a row of the editor (1024x600 with a longer caption, the card from y 115 and the editor from y 104) is there no room left to show it.The three points raised in #512:
docs/avatar-contract.mdnow says so.at <width>x<height> the caret at the end of a long line scrolls clear of Jim's stageruns at 1920x1080, 1366x900 and 1100x800, and at 1100x600 with a tall card, 1100x520 with a resize while the page is scrolled, 1000x700, and 1100x800 with the widest sidebar and a tall card. It types a 302-character line, presses Home to check that the line is longer than the editor, presses End so the browser scrolls to it, then checks that the last glyph painted on#editor-highlightdoes not overlap the stage, that#editor, which holds the caret, and#editor-linesscrolled exactly as far, and that the page adds no room past its end. At 1100 the stage is the compact card, so the row may end above it rather than left of it, which is what the bottom reservation provides. At 1000x700 the row is edited three rows above the end, where the browser has no reason to scroll the page; as the last row it would be scrolled into the 24 px below the card and pass without the change. With thereserveJimStageInEditor()call removed the test fails at all seven; at the three Jim's stage covers the editor, and Hide avatar does not free the space #512 asked for, the line ends at 1903.6 under the stage from 1728 at 1920, at 1349.6 under the stage from 1174 at 1366, and the last row ends at 658.2 under the card from 606.6 at 1100x800.the strip beside Jim's floating stage takes a click and stays blank in forced colorspins the click and the forced-colors border.on a phone the card across the editor reserves neither its width nor its bottom(481x1400, where the bottom would be the cheaper side),on a phone the caret typing on the last row scrolls the page clear of the card(390x844 with the self-view) anda stage that scrolls with the page adds no room below it, wherever the page ispin the phone. The caret test also states which side each size reserves, requires more than 80% of the width where it is the bottom, and keeps the last glyph 3 px clear of the stage, half the gap: at 1920x1080 in headless Chromium on Linux the glyph ends 5.44 px clear, so a full 6 px would fail the unchanged code. Removing the border, the forced-colors rule,scroll-padding-bottom, the gutter's bottom padding, the editor-stack observer, the scroll offsets, the cost comparison, the gap, the root's padding or scroll padding, or the breakpoint, scrollable or half-width conditions each fails one of these tests. Reading the stage before.scrollableis settled fails none of them; the right reserve reads onlystage.left, which.scrollabledoes not move.Before and after at 1366x900 and 1100x800, on the test page with a long line as the caret's row:
At this head
./scripts/test.sh rustpasses, andnode --test tests/browser/*.test.jspasses 3630 of 3666 here. It failsa formatter that cannot load changes nothing, and the next press loads itintests/browser/format-shortcut.test.js, which fails the same way with this change reverted and passes onmainin CI. It also fails two tests intests/browser/strict-selection.test.jsthat timed out under the full run's load and pass alone, twice each. Not run here: the other lanes of./scripts/test.sh, which CI runs, and the Java, ffmpeg and desktop tests. Not checked: Firefox and Safari, whose caret reveal may ignorescroll-padding-bottomon the textarea or the root (the last rows stay reachable by scrolling either way), and a live interview on a real phone.#713 also changes
placeJimStageBelowToolbar(), returningplaceand changing itsscrollablecondition, so whichever of the two lands second rebases.Close #512
Summary by cubic
Keeps the editor's scroll range clear of Jim's stage, so the caret and the end of a long line no longer scroll under it. This only changes the editor's scroll range; the floating stage, captions, self-view, and shell layout stay as accepted in #512.
Canvassystem color so it doesn't paint as a solid bar.scroll-padding-bottomkeeps the caret above the card while it grows with the captions.Closes #512.
Written for commit ca7b8ec. Summary will update on new commits.