Commit Graph
5479 Commits
Author SHA1 Message Date
Anthony Kim 9f232d981b destructure doc from target like the old days 2026-06-16 19:53:03 -07:00
Anthony Kim 1efd80cd17 Dont forget target.document 2026-06-16 19:44:27 -07:00
Anthony Kim 1701dcef90 use disposables for transient mouse listeners 2026-06-16 19:35:29 -07:00
Anthony Kim 55dbe3b65e use current document for mouse listeners 2026-06-16 19:21:19 -07:00
c8f11d63b5 fix(terminal): always run clear() at cursor home (#5992)
Remove early return when ybase===0 && y===0 so clear() always
clears markers, resets buffer lines, and refills the viewport.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 16:43:22 +00:00
3d929a1db0 fix(selection): drag-scroll end row and trim start clamp (#5993)
* fix(selection): drag-scroll end row matches last visible line

Use ydisp + rows - 1 for selectionEnd when scrolling down during drag,
consistent with finalSelectionEnd for select-all.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>

* fix(selection): reset start to origin when start row is trimmed

When handleTrim removes the selection start row, clamp to [0,0] and
refresh; do not keep a stale column on row 0.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-06 16:18:47 +00:00
Daniel ImmsandCursor f33f502267 fix(DomRenderer): resilience when buffer lines are missing (#5998)
* fix(DomRenderer): skip missing buffer lines during row render

renderRows and link underline refresh stopped updating when any
viewport row lacked buffer data, leaving stale DOM on rows below.
Match ImageStorage.render behavior: clear the row element when
present and continue with remaining rows.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(DomRenderer): clear blink state when skipping missing lines

When a viewport row has no buffer line, renderRows clears the row DOM
and continues but did not reset _rowHasBlinkingCells for that row.
That could leave the text blink manager thinking blinking cells remain
after the row was emptied.

Clear blink state for the row when skipping a missing buffer line,
including during link underline refresh.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 09:09:32 -07:00
jerch 596634ac41 fix #6003 (#6004) 2026-06-06 09:02:43 -07:00
Daniel ImmsandCursor f3f4dcaf9f fix(CharacterJoiner): bound join ranges to trimmed line length (#5990)
Character joiner scanning already iterated cells with
getTrimmedLength(), but trailing attribute runs and
_stringRangesToCellRanges used buffer cols. On short lines that
could run joiners on a single trailing cell and extend open ranges
through empty tail columns, affecting ligature/join rendering.

Use trimmed length consistently for trailing-run detection, the
cell-range walk, and the final range end column.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-03 07:05:19 -07:00
Daniel ImmsandCursor 564113e053 Add unit tests for parser reset, buffer scroll, ConPTY, and search (#5988)
* Add InputHandler unit tests for ISO-2022 charset mapping

InputHandler unit tests always used MockCharsetService, so regressions in
print()'s ASCII remapping, G0/G1 designation (ESC ( ) * +), and SO/SI
level switching were never caught at unit level.

Add an ISO-2022 character sets suite wired to real CharsetService and
BufferService that verifies DEC line drawing on G0 (ESC ( 0), G1 after
ESC ) 0 + SO, and charset/glevel restoration via ESC 7 / ESC 8 before
printing.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add BufferService.scroll unit tests for isUserScrolling

BufferService.scroll() adjusts ybase and ydisp differently depending on
whether the circular buffer is full and whether isUserScrolling is set,
but no unit test asserted those branches. InputHandler and other callers
use MockBufferService.scroll, which throws, so real scroll viewport logic
was only exercised indirectly.

Add BufferService.test.ts covering full-buffer scroll with the user
scrolled up (ydisp decrements), partial-buffer scroll while scrolled up
(ydisp unchanged), and full-buffer scroll at the viewport bottom
(ydisp tracks ybase).

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add InputHandler unit tests for DECOM cursor positioning

CUP with DEC origin mode (DECOM) offsets rows by the scroll region top
and clamps within DECSTBM margins, but unit tests only toggled the mode
for save/restore. Playwright covered the combination; headless unit tests
did not.

Add a cursor positioning test matching the Playwright DECOM case: with
margins and origin on, CUP places the cursor relative to scrollTop, clamps
to the margin, and uses absolute rows when origin is off.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add WindowsMode unit tests for wrap heuristic edges

ConPTY does not set isWrapped on soft-wrapped lines; updateWindowsModeWrappedState
infers wrapping from the last cell of the previous row. Browser Terminal tests
exercise this only through full writes, with no direct coverage of the helper
or negative cases (trailing space or null).

Add WindowsMode.test.ts asserting isWrapped is set for a full non-space line,
cleared for trailing whitespace, and cleared when the previous line ends empty.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add OscParser.reset unit test for mid-payload abort

OscParser.reset() must call end(false) on active handlers when aborted
during PAYLOAD, but no test invoked reset() directly. EscapeSequenceParser
tests mock OSC, so production reset/cleanup was unverified at unit level.

Add a reset describe block asserting handlers receive END false after a
partial payload, then a subsequent OSC sequence completes normally.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add DcsParser.reset unit test for mid-payload abort

DcsParser.reset() must call unhook(false) on hooked handlers when aborted
mid-DCS, matching OscParser's end(false) cleanup. No DcsParser test called
reset() directly, leaving the abort path unverified at unit level.

Add a reset describe block asserting UNHOOK false after partial put, then a
subsequent DCS sequence completes with UNHOOK true.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add InputHandler print tests for grapheme joining

print() uses UnicodeService.shouldJoin to merge combining marks, but
InputHandler tests never exercised that path. The U+200B infinite-loop
regression test used mocks and had no assertions, so it would pass even
if print() misbehaved.

Add tests for e + combining acute in one parse and across two parses.
Strengthen the U+200B regression test to use BufferService and assert the
buffer does not grow spurious rows.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add CharsetService unit tests for glevel and designation

CharsetService only updates the active charset when setgCharset targets the
current glevel; most InputHandler tests use MockCharsetService instead. A
regression in setgLevel or inactive-slot designation would not be caught
without direct service tests.

Add CharsetService.test.ts covering inactive designation, setgLevel
activation, active-slot updates, and reset clearing state.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add reflowCursorLine unit tests for ConPTY resize behavior

reflowCursorLine lets resize reflow wrapped lines that contain the cursor
(needed when ConPTY does not). No test referenced the option or
reflowLargerGetLinesToRemove's cursor skip branch.

Add BufferReflow tests for skip vs reflow when the cursor is inside a
wrapped block, and Buffer.resize tests showing merge on widen only when
reflowCursorLine is enabled.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add EscapeSequenceParser reset test for async pause recovery

reset() sets ParserStackType.RESET so the next parse continues in GROUND
at chunkPos + 1 without resuming a paused async handler. Existing async
tests only verified reset lifts FAIL after improper continuation, not
mid-chunk recovery with trailing printable data.

Add a test that pauses on async CSI, calls reset(), then continues parsing
and asserts XY is printed once and the stack returns to NONE.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add Buffer.resize unit test for ConPTY row growth

When rows increase on Windows ConPTY, Buffer.resize appends lines without
decrementing ybase or ydisp so the viewport stays stable while ConPTY
repaints. Buffer tests covered the non-Windows scroll-up path but never
passed windowsPty into options.

Add a ConPTY row-growth test asserting ybase, ydisp, and line count when
windowsPty is configured.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add Buffer reflow test for ConPTY buildNumber threshold

Buffer disables reflow on ConPTY when buildNumber is below 21376, but no
unit test asserted that gate. Column shrink without reflow leaves wrapped
content on a single line instead of splitting across rows.

Add a test comparing shrink behavior at build 21375 versus 21376, plus
retain unwrap-on-widen coverage for supported ConPTY builds.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add ApcParser.reset unit test for mid-payload abort

ApcParser.reset() calls end(false) on active handlers when aborted mid-APC,
matching OscParser and DcsParser, but no ApcParser test invoked reset()
directly.

Add a reset describe block asserting END false after partial put and a
clean subsequent APC sequence.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add InputHandler unit test for REP with grapheme clusters

repeatPrecedingCharacter uses parser.precedingJoinState and reprints the
full cluster from the buffer, but only Playwright covered e + combining
acute with CSI b. A regression could break REP for joined sequences without
failing unit tests.

Add a print-suite test asserting CSI 2 b triples e + acute in one parse.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add InputHandler unit tests for REP no-op cases

repeatPrecedingCharacter returns early when parser.precedingJoinState is
zero, including after another escape sequence clears join state. Only the
positive grapheme REP case was unit tested.

Add tests for bare CSI b and for REP following SGR so regressions cannot
spuriously duplicate buffer content.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add DecorationManager unit test for wrapped search matches

DecorationManager splits matches across wrapped rows with per-segment x
and width, but only SearchEngine had unit coverage; decoration geometry
was left to Playwright.

Add DecorationManager.test.ts using a real Terminal, a wrapped-buffer
match from SearchEngine, and assertions on registerDecoration options
for both row segments.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add BufferService.scroll unit test for DECSTBM margins

When scrollTop is non-zero, scroll() shifts lines inside the margin with
shiftElements instead of pushing scrollback. Existing BufferService tests
only covered scrollTop === 0.

Add a test with margins on rows 1–3 that verifies rows outside the region
stay fixed and lines inside the region scroll correctly.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add BufferService.scrollLines unit tests

scrollLines adjusts ydisp and toggles isUserScrolling for viewport
scrolling, but only scroll() had unit coverage. Regressions in the
user-scroll flag or ydisp clamping would affect the whole viewport.

Add tests for scrolling up, clamping at ydisp 0, and clearing
isUserScrolling when reaching the buffer bottom.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Add DecorationManager overview ruler dedup unit test

Multiple highlight matches on the same buffer line should only register
one overview ruler marker; later matches on that line omit ruler options.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Assert overview ruler on each line of wrapped search match

Wrapped highlight decorations span two buffer lines; each segment
should register overview ruler options unlike same-line dedup.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 12:41:54 +00:00
b3de9fa6db fix(buffer): clear stale attrs and combined data in BufferLine (#5972)
* fix(buffer): bound combined-cell copy in copyCellsFrom

When copying a column range, combined-string metadata was copied for
every source column >= srcCol with no upper limit. Partial copies could
pull _combined entries from outside [srcCol, srcCol + length) into the
destination and corrupt cells beyond the copied span.

Only copy combined keys within the same range as the cell data loop.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(buffer): clear stale _combined entry in BufferLine.setCell

setCell updated combined data when IS_COMBINED_MASK was set but left
orphaned _combined[index] entries when writing a non-combined cell.
Delete the map entry in that case so later combined copies and lookups
stay aligned with cell content flags.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(buffer): clear stale extended attrs in BufferLine.setCell

setCell stored extended attributes when HAS_EXTENDED was set but did
not remove orphaned _extendedAttrs[index] when overwriting with a
cell without extended background data. Delete the entry in that case,
matching the combined-cell cleanup added for setCell earlier.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(buffer): clear dest extended attrs in copyCellsFrom

When copying a column range, extended attributes were copied from
source cells with HAS_EXTENDED but stale _extendedAttrs on the
destination were left for cells without extended data. Delete dest
entries in that case, matching setCell behavior and the bounded
_combined copy loop.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(buffer): clear extended attrs in setCellFromCodepoint

The input-handler fast path set extended data when HAS_EXTENDED was
present but left orphaned _extendedAttrs entries when overwriting
with non-extended cells. Delete the map entry in that case, matching
setCell and copyCellsFrom.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(buffer): clear stale combined data in setCellFromCodepoint

When the input handler overwrites a cell that previously held a
grapheme cluster (IS_COMBINED_MASK), setCellFromCodepoint updated
_data and _extendedAttrs but left this._combined[index] intact.
setCell already deletes _combined for non-combined cells; this path
did not, so getString and renderers could show the old cluster string
after a normal codepoint write.

Add delete this._combined[index] at the start of setCellFromCodepoint,
matching setCell's non-combined branch and the extended-attrs cleanup
already performed in the same method.

Co-authored-by: Cursor <cursoragent@cursor.com>

* perf(buffer): only delete stale combined/extended map entries when present

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>

* fix(buffer): treat combined/extended maps as flag-gated caches

_flags in _data are authoritative; sparse maps are only read when
IS_COMBINED_MASK or HAS_EXTENDED is set. setCellFromCodepoint no longer
touches _combined. loadCell clears CellData side fields when flags are off.
copyCellsFrom copies map entries per-cell from src flags only.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-02 03:04:25 +00:00
Daniel Imms a374c6c5af Merge pull request #5980 from xtermjs/cursor/browser-functional-fixes-b5c0
fix(browser): debounce, render, mouse coords, and CoreBrowserTerminal
2026-06-01 09:23:57 -07:00
Cursor AgentandDaniel Imms 454e0749c2 fix(browser): use ??= in RenderDebouncer for lint
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-01 16:15:01 +00:00
Daniel Imms 59264f1f5b Merge pull request #5974 from xtermjs/cursor/parser-validation-fixes-89d6
fix(parser): Params error grammar and ESC prefix precedence
2026-06-01 09:05:28 -07:00
Cursor AgentandDaniel Imms 16ef64f8bf Merge origin/master into cursor/browser-functional-fixes-b5c0
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-01 15:59:10 +00:00
Daniel Imms 5b911db9cf Merge branch 'master' into cursor/test-fixes-explore-e565 2026-06-01 08:45:29 -07:00
Daniel Imms 94958c2489 Fix whitespace 2026-06-01 08:33:02 -07:00
Cursor AgentandDaniel Imms 096707d736 test: fix typos in test titles and comments
Apply test-only hunks from docs typo fixes: SharedRendererTests
duplicate word, SerializeAddon workaround comment, and mouse range
spelling in MouseService and InputHandler tests.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-06-01 15:29:18 +00:00
Daniel ImmsandCursor 8e7e4f16e5 test(parser): fix typo in EscapeSequenceParser test title
Rename the mocha case "inital states" to "initial states".

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:29:07 +00:00
Daniel ImmsandCursor be3dd80171 docs(parser): fix JSDoc typos in IFunctionIdentifier
Correct "representation" and "registration" spelling in the comment
describing how handler identifiers are encoded for EscapeSequenceParser.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:36 +00:00
Daniel ImmsandCursor 2db34c4955 docs(common): fix main thread spelling in TaskQueue comment
Change "mainthread" to "main thread" in the workload scheduling note.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:36 +00:00
Daniel ImmsandCursor 8854430df4 docs(parser): fix sub-parameter limit name in Params JSDoc
addSubParam documents a cap on stored sub parameters; the limit is
enforced via maxSubParamsLength, not subParamsLength (the current count).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:36 +00:00
Daniel ImmsandCursor 26e771d075 docs(common): fix grammar in Unicode and platform comments
Use "a Unicode" instead of "an Unicode" on IUnicodeService.register,
and "user's platform" instead of "users platform" above the platform
detection exports.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:36 +00:00
Daniel ImmsandCursor fd13893687 docs(buffer): fix possessive typo in Windows conpty comment
Change "it's view" to "its view" in the comment explaining why new
rows are appended on Windows when using conpty.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:36 +00:00
Daniel ImmsandCursor 5ef8001413 docs(common): fix activeVersion onChange JSDoc wording
The onChange event comment said "activate version changed" while the
property is activeVersion. Clarify that the event fires when the active
Unicode version changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:36 +00:00
Daniel ImmsandCursor e2d1420ff7 docs(common): fix throughput typo in WriteBuffer comment
Correct "throughtput" to "throughput" in the FPS vs throughput tradeoff
note inside WriteBuffer.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:36 +00:00
Daniel ImmsandCursor cf1484d7fd docs(browser): fix incomplete and typo comments in Mouse.ts
getCoords had a truncated comment ("if there are no valid") and a typo
("addition" vs "additional") in the selection precision note. Complete
the char-size guard comment and fix the selection wording.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:36 +00:00
Daniel ImmsandCursor e12f007597 docs(buffer): fix Content enum names in Constants JSDoc
The Content bitmask JSDoc examples used camelCase names that do not
exist on the enum (codepointMask, isCombined, hasContent, widthMask,
widthShift). Update examples to match the real members:
CODEPOINT_MASK, IS_COMBINED_MASK, HAS_CONTENT_MASK, WIDTH_MASK, and
WIDTH_SHIFT as used throughout BufferLine and CellData.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:35 +00:00
Daniel ImmsandCursor 7b05c8a1b2 docs: fix comment and JSDoc spelling typos
Correct "occurred" in IMouseEvent and keydown JSDoc, remove duplicate
"This" in EscapeSequenceParser ZDM comment, use "elapsed" instead of
"lapsed" in TimeBasedDebouncer, and fix "event" in Keyboard comment.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:14 +00:00
Daniel ImmsandCursor b45167e00b docs: fix comment typos in ThemeService and Constants
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:14 +00:00
Daniel ImmsandCursor bc42be2074 docs(common): correct ST sequence metadata and comment typos
- EscapeSequenceParser: ESC ST is ESC backslash (0x1B 0x5C), not ESC
  plus a double-quote character; align @vt metadata with C1 ST on the
  following line.
- Color.contrastRatio: document l2 as the second luminance argument.
- Marker.dispose: fix "change" -> "chance" in dispose listener comment.
- Buffer.clear: fix possessive "it's" -> "its" in JSDoc.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:14 +00:00
Daniel ImmsandCursor bc26cc16c1 fix(browser): place imports before module const in TimeBasedDebouncer
RENDER_DEBOUNCE_THRESHOLD_MS was declared above the import, which
breaks ES module conventions and can confuse tooling. Move the import
to the top of the module after the license header.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:07 +00:00
Daniel ImmsandCursor 80468eeb4c fix(browser): clear idle blink timer when handle is 0
_clearIdleTimer() used truthiness on _idleTimeout, so a setTimeout
handle of 0 would not be cleared. Compare against undefined, consistent
with RenderDebouncer rAF handling.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:07 +00:00
Daniel ImmsandCursor 69b11a1a48 fix(browser): treat rAF id 0 as scheduled in RenderDebouncer
dispose(), addRefreshCallback(), and refresh() used truthiness on
_animationFrame, so a requestAnimationFrame handle of 0 would not be
cancelled or deduplicated. Compare against undefined instead, matching
other timer checks in the browser layer.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:07 +00:00
Daniel ImmsandCursor 98d7c25bd5 fix(browser): cancel trailing debounce timeout on immediate refresh
TimeBasedDebouncer can schedule a trailing setTimeout when refresh
requests are throttled. If the debounce window later elapses and an
immediate refresh runs, that pending timeout was left armed and could
fire afterward, causing a duplicate _innerRefresh (e.g. extra live
region updates for screen readers).

Clear any pending timeout and reset _additionalRefreshRequested before
running the immediate refresh path.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:07 +00:00
Daniel ImmsandCursor 4500485e79 fix(parser): validate ESC prefix byte range with correct precedence
_identifier() checked custom prefix bytes with
`res && 0x3c > res || res > 0x3f`, which parsed as
`(res && 0x3c > res) || (res > 0x3f)` because && binds tighter
than ||. A prefix of NUL (0x00) skipped both clauses and was
accepted even though only 0x3c..0x3f are valid.

Use an explicit range test: res < 0x3c || res > 0x3f. Mirror the
same fix in ApcParser and DcsParser test identifier helpers.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:04 +00:00
Daniel ImmsandCursor 1a01e9634f fix(parser): use correct grammar in Params validation errors
Replace "values lesser than -1" with "values less than -1" in
addParam and addSubParam throw messages. "Lesser" is not standard
English for numeric comparisons; tests assert the exact message.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:28:04 +00:00
Daniel ImmsandCursor 1dd113b38a fix(browser): reset TimeBasedDebouncer state on dispose
dispose() cleared the pending timeout but left _refreshTimeoutID and
_additionalRefreshRequested set. After dispose, a stale timeout id or
trailing-refresh flag could confuse a new instance or tests. Match
RenderDebouncer by clearing the timeout id and reset the trailing flag.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:27:54 +00:00
Daniel ImmsandCursor 536eeb4db0 refactor(browser): remove unreachable coords guard in getCoords
getCoordsRelativeToElement always returns a two-element tuple, so the
array is always truthy and if (!coords) could never run. hasValidCharSize
already handles the only early-exit path before coordinates are computed.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:27:54 +00:00
Daniel ImmsandCursor 3f3f6abfb9 fix(browser): parenthesize document fallback for CoreBrowserService
Nullish coalescing binds tighter than the conditional operator, so the
previous expression was parsed as (this._document ?? windowDefined) ?
window.document : null. When this._document was set (e.g. parent
ownerDocument or documentOverride), the ternary still returned
window.document instead of the configured document.

CoreBrowserService.mainDocument is used by AccessibilityManager, viewport
styles, and decoration renderers; CharSizeService already received
this._document directly. Add parentheses so the fallback applies only when
_document is nullish.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:27:54 +00:00
Daniel ImmsandCursor c961408bf7 fix(browser): use startY in horizontalDirection row helper call
horizontalDirection called moveToRequestedRow with targetX as the first
argument, but that parameter is the starting row (startY). resetStartingRow
and moveToRequestedCol already pass startY correctly; only this copy-paste
mistake passed a column index where a row was expected.

That could miscompute wrapped-row offsets and emit the wrong horizontal
arrow key sequence when building selection/cursor movement strings.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:27:54 +00:00
Daniel ImmsandCursor b0f6aed4a1 fix(common): pass radix 10 when parsing OSC color indices
InputHandler parsed palette indices from OSC color sequences with
parseInt without a radix after validating digits-only slots. Use
base 10 for set/report and restore color index parsing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:05:43 +00:00
Daniel ImmsandCursor 878e3fc52d fix(browser): pass radix 10 when parsing Chrome major version
Wheel event DPR factoring parses Chrome/(\d+) with parseInt without a
radix. Add base 10 explicitly, matching getSafariVersion and other
version parsing in the codebase.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:05:43 +00:00
Daniel ImmsandCursor f04679a42e fix(common): pass radix 10 when parsing rgb() components in Color
rgba/rgb CSS parsing used parseInt without a radix on captured digit
groups. Add base 10 explicitly, matching getSafariVersion and other
call sites in the codebase.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:05:43 +00:00
Daniel ImmsandCursor 6ebcf79358 fix(common): pass radix 10 to parseInt in getSafariVersion
Safari major version parsing used parseInt without an explicit radix.
Other call sites in the repo use base 10; add the radix for consistency
and to avoid octal interpretation of leading-zero strings.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:05:43 +00:00
Daniel ImmsandCursor d4acf2fa45 fix(browser): use radix 10 for padding parseInt in Mouse coords
parseInt without a radix can mis-parse leading-zero padding values as
octal. Match AccessibilityManager and document rowCount JSDoc typo.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:05:43 +00:00
Daniel Imms ddf2b7d091 Merge pull request #5969 from Tyriar/import-no-cycle-5897-2
Add oxlint import/no-cycle and break existing src/common cycles
2026-05-31 15:13:58 -07:00
Daniel ImmsandCursor 5684f95c8e Colocate circular list types in CircularList.ts
The import/no-cycle refactor had moved IInsertEvent, IDeleteEvent, and
ICircularList into Types.ts, with CircularList.ts re-exporting the event
types from there. That split the list abstraction from its implementation
and pulled Types into the circular-list dependency graph.

Define IInsertEvent, IDeleteEvent, and ICircularList in CircularList.ts
alongside the CircularList class. CircularList.ts now depends only on
Lifecycle and Event, not Types.ts.

Remove those definitions from Types.ts (and the unused Emitter import).

Update callers to import list types from CircularList:
- buffer/Types.ts (IBuffer.lines)
- DecorationService.ts (buffer line insert/delete handlers)
- browser TestUtils.test.ts (mock buffer lines)

Types.ts no longer imports or re-exports circular-list types, preserving
the acyclic Types -> buffer/CircularList boundary.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-31 14:37:01 -07:00
Daniel ImmsandCursor cd3dcc52b2 Colocate buffer types in buffer/Types.ts
The import/no-cycle refactor had moved IBuffer, IBufferSet, and related
cell/line types into src/common/Types.ts, with buffer/Types.ts only
re-exporting them. That inverted the natural module boundary and made
buffer code depend on the top-level types hub.

Define buffer-owned types in buffer/Types.ts instead:
- CharData, IExtendedAttrs, IAttributeData, ICellData, IBufferLine
- IMarker, IBuffer, IBufferSet, BufferIndex

Restore UnderlineStyle to buffer/Constants.ts (used by IExtendedAttrs)
and remove those definitions from Types.ts.

buffer/Types.ts imports only what it needs from outside the buffer layer:
ICircularList and ICharset from Types, IDisposable from Lifecycle,
IEvent from Event, and UnderlineStyle from Constants. Types.ts does not
import buffer/Types.ts, so the previous Types <-> buffer cycle stays broken.

Update imports across common, browser, headless, addons, and tests to use
common/buffer/Types for buffer types rather than common/Types.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-31 14:35:08 -07:00
Per Bothner 35c91cbf2d Merge branch 'master' into decoration-test 2026-05-31 10:13:17 -07:00