@deepseek-harness-tui/dsh-tui 0.20.0 → 0.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -3
- package/bin/dsh-tui.js +26 -8
- package/guide/dsh-tui-guide/claude-backend.en.md +6 -5
- package/guide/dsh-tui-guide/claude-backend.md +5 -5
- package/guide/dsh-tui-guide/configuration.en.md +26 -12
- package/guide/dsh-tui-guide/configuration.md +18 -9
- package/guide/dsh-tui-guide/getting-started.en.md +17 -9
- package/guide/dsh-tui-guide/getting-started.md +11 -7
- package/guide/dsh-tui-guide/interaction.en.md +1 -0
- package/guide/dsh-tui-guide/interaction.md +1 -0
- package/guide/dsh-tui-guide/migrate.en.md +5 -0
- package/guide/dsh-tui-guide/migrate.md +4 -0
- package/guide/dsh-tui-guide/plugins.en.md +17 -1
- package/guide/dsh-tui-guide/plugins.md +12 -1
- package/guide/dsh-tui-guide/themes.en.md +1 -1
- package/guide/dsh-tui-guide/themes.md +1 -1
- package/guide/dsh-tui-guide/user-guide.en.md +8 -2
- package/guide/dsh-tui-guide/user-guide.md +8 -2
- package/lib/settings.json +19 -3
- package/lib/types/adapter/kernel/host-facade.d.ts +3 -1
- package/lib/types/adapter/kernel/host-facade.d.ts.map +1 -1
- package/lib/types/adapter/kernel/host-facade.js +6 -0
- package/lib/types/adapter/kernel/runtime.d.ts.map +1 -1
- package/lib/types/adapter/kernel/runtime.js +5 -0
- package/lib/types/adapter/kernel/slices/extensions.d.ts +1 -0
- package/lib/types/adapter/kernel/slices/extensions.d.ts.map +1 -1
- package/lib/types/adapter/kernel/slices/extensions.js +6 -1
- package/lib/types/adapter/kernel/slices/index.d.ts +1 -1
- package/lib/types/adapter/kernel/slices/index.d.ts.map +1 -1
- package/lib/types/adapter/kernel/slices/index.js +3 -2
- package/lib/types/adapter/ports/channel-catalog.d.ts +19 -0
- package/lib/types/adapter/ports/channel-catalog.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-settings.d.ts +6 -0
- package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
- package/lib/types/adapter/ports/channel-view.d.ts +28 -2
- package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
- package/lib/types/adapter/ports/extensions.d.ts +9 -0
- package/lib/types/adapter/ports/extensions.d.ts.map +1 -1
- package/lib/types/adapter/ports/index.d.ts +1 -1
- package/lib/types/adapter/ports/index.d.ts.map +1 -1
- package/lib/types/adapter/upstream/extensions-driver.d.ts +4 -1
- package/lib/types/adapter/upstream/extensions-driver.d.ts.map +1 -1
- package/lib/types/adapter/upstream/extensions-driver.js +111 -1
- package/lib/types/adapter/upstream/index.d.ts +1 -1
- package/lib/types/adapter/upstream/index.d.ts.map +1 -1
- package/lib/types/adapter/upstream/index.js +1 -1
- package/lib/types/api.d.ts +1 -1
- package/lib/types/api.d.ts.map +1 -1
- package/lib/types/backends/claude/backend.d.ts.map +1 -1
- package/lib/types/backends/claude/backend.js +7 -2
- package/lib/types/backends/claude/session/lifecycle.d.ts.map +1 -1
- package/lib/types/backends/claude/session/lifecycle.js +11 -9
- package/lib/types/backends/claude/side-query.d.ts +2 -0
- package/lib/types/backends/claude/side-query.d.ts.map +1 -1
- package/lib/types/backends/claude/side-query.js +30 -13
- package/lib/types/components/FileSuggestions.d.ts +2 -2
- package/lib/types/components/FileSuggestions.d.ts.map +1 -1
- package/lib/types/components/FileSuggestions.js +25 -5
- package/lib/types/components/PromptInput.d.ts +7 -1
- package/lib/types/components/PromptInput.d.ts.map +1 -1
- package/lib/types/components/PromptInput.js +81 -23
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
- package/lib/types/components/messages/AssistantToolUseMessage.js +228 -27
- package/lib/types/components/messages/presentCardBackground.d.ts +28 -0
- package/lib/types/components/messages/presentCardBackground.d.ts.map +1 -0
- package/lib/types/components/messages/presentCardBackground.js +23 -0
- package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
- package/lib/types/dsh-adapter/backend/translate.js +28 -1
- package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/core/files.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/file-actions.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/file-actions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/file-actions.js +11 -4
- package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/settings-host.js +78 -12
- package/lib/types/dsh-adapter/channel/state.d.ts +4 -3
- package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/state.js +4 -3
- package/lib/types/dsh-adapter/channel/types.d.ts +1 -1
- package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel.d.ts +1 -1
- package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
- package/lib/types/dsh-adapter/childStderr.d.ts +1 -1
- package/lib/types/dsh-adapter/childStderr.d.ts.map +1 -1
- package/lib/types/dsh-adapter/childStderr.js +5 -0
- package/lib/types/dsh-adapter/contract.d.ts +23 -8
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +27 -7
- package/lib/types/dsh-adapter/extensions.d.ts +3 -2
- package/lib/types/dsh-adapter/extensions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/extensions.js +5 -2
- package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
- package/lib/types/dsh-adapter/host-contract.js +1 -1
- package/lib/types/dsh-adapter/host-dsh.d.ts +4 -0
- package/lib/types/dsh-adapter/host-dsh.d.ts.map +1 -1
- package/lib/types/dsh-adapter/host-dsh.js +26 -0
- package/lib/types/dsh-adapter/host-entry.js +4 -2
- package/lib/types/dsh-adapter/host-service-diagnostics.d.ts +61 -0
- package/lib/types/dsh-adapter/host-service-diagnostics.d.ts.map +1 -0
- package/lib/types/dsh-adapter/host-service-diagnostics.js +103 -0
- package/lib/types/dsh-adapter/index.d.ts +5 -0
- package/lib/types/dsh-adapter/index.d.ts.map +1 -1
- package/lib/types/dsh-adapter/index.js +1 -0
- package/lib/types/dsh-adapter/mention-providers.d.ts +91 -0
- package/lib/types/dsh-adapter/mention-providers.d.ts.map +1 -0
- package/lib/types/dsh-adapter/mention-providers.js +214 -0
- package/lib/types/dsh-adapter/migrate/entry.d.ts +2 -0
- package/lib/types/dsh-adapter/migrate/entry.d.ts.map +1 -0
- package/lib/types/dsh-adapter/migrate/entry.js +46 -0
- package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
- package/lib/types/dsh-adapter/plugin.js +42 -2
- package/lib/types/dsh-adapter/present-tool.d.ts +20 -0
- package/lib/types/dsh-adapter/present-tool.d.ts.map +1 -0
- package/lib/types/dsh-adapter/present-tool.js +96 -0
- package/lib/types/extensions.d.ts +2 -0
- package/lib/types/extensions.d.ts.map +1 -1
- package/lib/types/extensions.js +4 -1
- package/lib/types/i18n.d.ts +21 -2
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +9 -1
- package/lib/types/ink/components/ScrollBox.d.ts.map +1 -1
- package/lib/types/ink/components/ScrollBox.js +13 -0
- package/lib/types/ink/dom.d.ts +3 -0
- package/lib/types/ink/dom.d.ts.map +1 -1
- package/lib/types/ink/ink.d.ts.map +1 -1
- package/lib/types/ink/ink.js +30 -34
- package/lib/types/ink/render-node-to-output.d.ts +3 -0
- package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
- package/lib/types/ink/render-node-to-output.js +54 -40
- package/lib/types/ink/selection.d.ts +38 -28
- package/lib/types/ink/selection.d.ts.map +1 -1
- package/lib/types/ink/selection.js +201 -130
- package/lib/types/kernelPrefs.d.ts +5 -2
- package/lib/types/kernelPrefs.d.ts.map +1 -1
- package/lib/types/kernelPrefs.js +5 -2
- package/lib/types/screens/Chat.d.ts +4 -1
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +2 -2
- package/lib/types/settings/definitions.d.ts +12 -0
- package/lib/types/settings/definitions.d.ts.map +1 -1
- package/lib/types/settings/definitions.js +10 -2
- package/lib/types/theme.d.ts +4 -0
- package/lib/types/theme.d.ts.map +1 -1
- package/lib/types/theme.js +20 -2
- package/lib/types/tuiDisplayPrefs.d.ts +3 -0
- package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
- package/lib/types/tuiDisplayPrefs.js +10 -0
- package/lib/types/update.d.ts +74 -5
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +297 -46
- package/lib/types/updateHost.d.ts.map +1 -1
- package/lib/types/updateHost.js +16 -5
- package/lib/types/usageStats.d.ts +6 -0
- package/lib/types/usageStats.d.ts.map +1 -1
- package/lib/types/usageStats.js +8 -0
- package/lib/types/utils/colorMix.d.ts +19 -0
- package/lib/types/utils/colorMix.d.ts.map +1 -0
- package/lib/types/utils/colorMix.js +51 -0
- package/lib/types/utils/commandLine.d.ts +8 -0
- package/lib/types/utils/commandLine.d.ts.map +1 -0
- package/lib/types/utils/commandLine.js +37 -0
- package/lib/types/utils/desktopEntry.d.ts +32 -0
- package/lib/types/utils/desktopEntry.d.ts.map +1 -0
- package/lib/types/utils/desktopEntry.js +302 -0
- package/lib/types/utils/externalEditor.d.ts +2 -5
- package/lib/types/utils/externalEditor.d.ts.map +1 -1
- package/lib/types/utils/externalEditor.js +4 -36
- package/lib/types/utils/fileSuggestions.d.ts +14 -3
- package/lib/types/utils/fileSuggestions.d.ts.map +1 -1
- package/lib/types/utils/fileSuggestions.js +33 -0
- package/lib/types/utils/openExternal.d.ts +9 -0
- package/lib/types/utils/openExternal.d.ts.map +1 -1
- package/lib/types/utils/openExternal.js +87 -3
- package/lib/types/utils/terminalLaunch.d.ts +16 -0
- package/lib/types/utils/terminalLaunch.d.ts.map +1 -0
- package/lib/types/utils/terminalLaunch.js +121 -0
- package/package.json +116 -110
- package/tui-profile/feed/README.md +1 -1
- package/tui-profile/feed/first-party.json +1 -1
package/lib/types/ink/ink.js
CHANGED
|
@@ -39,7 +39,7 @@ import { applyPositionedHighlight, scanPositions } from './render-to-screen.js';
|
|
|
39
39
|
import createRenderer from './renderer.js';
|
|
40
40
|
import { CharPool, cellAt, createScreen, HyperlinkPool, isEmptyCellAt, migrateScreenPools, StylePool } from './screen.js';
|
|
41
41
|
import { applySearchHighlight } from './transcript-highlight.js';
|
|
42
|
-
import { applySelectionOverlay, captureScrolledRows, clearSelection, createSelectionState, extendSelection, findPlainTextUrlAt, getSelectedText, getSelectionCursor, hasSelection, moveFocus, pickFollowForSelection, refreshSelectionFingerprint, refreshSelectionPane, selectLineAt, selectWordAt, shiftSelection,
|
|
42
|
+
import { applySelectionOverlay, captureScrolledRows, clearSelection, createSelectionState, extendSelection, findPlainTextUrlAt, getSelectedText, getSelectionCursor, hasSelection, moveFocus, pickFollowForSelection, refreshSelectionFingerprint, refreshSelectionPane, selectLineAt, selectWordAt, shiftSelection, shiftSelectionForViewportResize, shiftSelectionForViewportTranslation, startSelection, updateSelection } from './selection.js';
|
|
43
43
|
import { isDecstbmSafe, SYNC_OUTPUT_SUPPORTED, serializeDiff, supportsCursorStyleReset, supportsDecrqmProbe, supportsExtendedKeys, supportsWin32InputMode, writeDiffToTerminal } from './terminal.js';
|
|
44
44
|
import { CURSOR_HOME, cursorMove, cursorPosition, cursorStyle, DISABLE_KITTY_KEYBOARD, DISABLE_MODIFY_OTHER_KEYS, DISABLE_WIN32_INPUT_MODE, ENABLE_KITTY_KEYBOARD, ENABLE_MODIFY_OTHER_KEYS, ENABLE_WIN32_INPUT_MODE, ERASE_SCREEN, ERASE_SCROLLBACK, SGR_RESET } from './termio/csi.js';
|
|
45
45
|
import { DBP, DFE, DISABLE_MOUSE_TRACKING, ENABLE_MOUSE_TRACKING, ENTER_ALT_SCREEN, ESU, EXIT_ALT_SCREEN, HIDE_CURSOR, SHOW_CURSOR } from './termio/dec.js';
|
|
@@ -768,7 +768,7 @@ export default class Ink {
|
|
|
768
768
|
// and this frame's wheel drain translates normally.
|
|
769
769
|
const viewportResizes = consumeViewportResizes();
|
|
770
770
|
if (viewportResizes.length > 0 && this.selection.anchor) {
|
|
771
|
-
const resize = pickFollowForSelection(viewportResizes, this.selection.anchor.row, this.selection.anchor.col);
|
|
771
|
+
const resize = pickFollowForSelection(viewportResizes, this.selection.anchor.row, this.selection.virtualAnchorCol ?? this.selection.anchor.col);
|
|
772
772
|
// Terminal resize rebuilds the screen at new dimensions; the
|
|
773
773
|
// selection's screen-buffer coords are stale against the previous
|
|
774
774
|
// frame's buffer and band capture would read garbage. Chrome-mount
|
|
@@ -785,7 +785,7 @@ export default class Ink {
|
|
|
785
785
|
cb();
|
|
786
786
|
}
|
|
787
787
|
else {
|
|
788
|
-
shiftSelectionForViewportResize(this.selection, this.frontFrame.screen, resize.prevTop, resize.prevBottom, resize.top, resize.bottom);
|
|
788
|
+
shiftSelectionForViewportResize(this.selection, this.frontFrame.screen, resize.prevTop, resize.prevBottom, resize.top, resize.bottom, resize.boxDeltaY ?? 0);
|
|
789
789
|
selectionCoordinated = true;
|
|
790
790
|
// Both-ends-covered clear must notify React-land so useHasSelection
|
|
791
791
|
// re-renders and the footer copy/escape hint disappears — direct
|
|
@@ -809,7 +809,12 @@ export default class Ink {
|
|
|
809
809
|
// (screen-local) so only anchor shifts — selection grows toward the
|
|
810
810
|
// mouse as the anchor walks up. After release, both ends are text-
|
|
811
811
|
// anchored and move as a block.
|
|
812
|
-
const
|
|
812
|
+
const followEvents = consumeFollowScroll();
|
|
813
|
+
const follow = pickFollowForSelection(followEvents, this.selection.anchor?.row ?? null,
|
|
814
|
+
// A pane anchor that scrolled above the viewport has its col clamped
|
|
815
|
+
// to 0; the virtual col is the pane-origin column and is what the
|
|
816
|
+
// viewport attribution must use on the next frame.
|
|
817
|
+
this.selection.virtualAnchorCol ?? this.selection.anchor?.col);
|
|
813
818
|
// pickFollowForSelection already checked anchor-in-viewport (that IS
|
|
814
819
|
// the "selection is on scrollbox content" guard — footer/prompt
|
|
815
820
|
// selections on static text match no viewport and follow nothing).
|
|
@@ -827,8 +832,8 @@ export default class Ink {
|
|
|
827
832
|
// OPPOSITE direction so they track the text, not the screen.
|
|
828
833
|
const rows = Math.abs(delta);
|
|
829
834
|
const up = delta > 0;
|
|
830
|
-
const firstRow = up ? viewportTop : viewportBottom - rows + 1;
|
|
831
|
-
const lastRow = up ? viewportTop + rows - 1 : viewportBottom;
|
|
835
|
+
const firstRow = up ? viewportTop : Math.max(viewportTop, viewportBottom - rows + 1);
|
|
836
|
+
const lastRow = up ? Math.min(viewportBottom, viewportTop + rows - 1) : viewportBottom;
|
|
832
837
|
const side = up ? 'above' : 'below';
|
|
833
838
|
const shift = up ? -rows : rows;
|
|
834
839
|
// captureScrolledRows and shift* are a pair: capture grabs rows about
|
|
@@ -840,47 +845,38 @@ export default class Ink {
|
|
|
840
845
|
// each shift branch so the pairing can't be broken by a new guard.
|
|
841
846
|
if (this.selection.isDragging) {
|
|
842
847
|
if (hasSelection(this.selection)) {
|
|
843
|
-
captureScrolledRows(this.selection, this.frontFrame.screen, firstRow, lastRow, side, follow.screenRowOffset);
|
|
848
|
+
captureScrolledRows(this.selection, this.frontFrame.screen, firstRow, lastRow, side, follow.screenRowOffset, -shift);
|
|
844
849
|
// Record the viewport bounds for finishSelection's deferred
|
|
845
850
|
// commit-time check: the in-flight drag never clears (a wheel
|
|
846
851
|
// must not kill the gesture), so a drag that wheeled fully
|
|
847
852
|
// off-edge is dropped when it ENDS, not while it is running.
|
|
848
853
|
this.selection.dragBounds = { top: viewportTop, bottom: viewportBottom };
|
|
849
854
|
}
|
|
850
|
-
//
|
|
851
|
-
//
|
|
852
|
-
|
|
855
|
+
// A live drag keeps its focus at the mouse (screen-local); only the
|
|
856
|
+
// text anchor follows the scroll, so the selection grows toward the
|
|
857
|
+
// held pointer instead of collapsing inward. allowClear=false: the
|
|
858
|
+
// ghost guard runs at release via dragBounds.
|
|
859
|
+
shiftSelection(this.selection, shift, viewportTop, viewportBottom, this.frontFrame.screen.width, false, false);
|
|
853
860
|
selectionCoordinated = true;
|
|
854
861
|
}
|
|
855
862
|
else if (
|
|
856
|
-
//
|
|
857
|
-
//
|
|
858
|
-
//
|
|
859
|
-
//
|
|
860
|
-
//
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
// contents — no accumulation. Both endpoints are text-anchored in
|
|
866
|
-
// the active drag branch too, so a wheel cannot leave focus on the
|
|
867
|
-
// old screen row.
|
|
868
|
-
!this.selection.focus || this.selection.focus.row >= viewportTop && this.selection.focus.row <= viewportBottom) {
|
|
863
|
+
// Preserve the flag-3 guard: a selection that started in the
|
|
864
|
+
// scrollbox and ended in static chrome (footer/composer) must not
|
|
865
|
+
// be teleported into the scrollbox by a wheel. A text-anchored
|
|
866
|
+
// endpoint that scrolled off-screen has a virtual row and is
|
|
867
|
+
// different: it belongs to this viewport and keeps following.
|
|
868
|
+
!this.selection.focus ||
|
|
869
|
+
(this.selection.focus.row >= viewportTop &&
|
|
870
|
+
this.selection.focus.row <= viewportBottom) ||
|
|
871
|
+
this.selection.virtualFocusRow !== undefined) {
|
|
869
872
|
if (hasSelection(this.selection)) {
|
|
870
873
|
captureScrolledRows(this.selection, this.frontFrame.screen, firstRow, lastRow, side, follow.screenRowOffset);
|
|
871
874
|
}
|
|
872
|
-
|
|
875
|
+
// A released selection is text-anchored at BOTH ends. Keep it
|
|
876
|
+
// through the off-screen range (allowClear=false): the user can
|
|
877
|
+
// scroll back and still copy the captured rows.
|
|
878
|
+
shiftSelection(this.selection, shift, viewportTop, viewportBottom, this.frontFrame.screen.width, false);
|
|
873
879
|
selectionCoordinated = true;
|
|
874
|
-
// Auto-clear (both ends overshot an edge — off the top via
|
|
875
|
-
// follow/wheel-down, off the bottom via wheel-up) must notify
|
|
876
|
-
// React-land so useHasSelection re-renders and the footer
|
|
877
|
-
// copy/escape hint disappears. notifySelectionChange() would
|
|
878
|
-
// recurse into onRender; fire the listeners directly — they
|
|
879
|
-
// schedule a React update for LATER, they don't re-enter this
|
|
880
|
-
// frame. (#185 self-heal guard: same as selection.notify.)
|
|
881
|
-
if (cleared)
|
|
882
|
-
for (const cb of this.selectionListeners)
|
|
883
|
-
callWithUpdateOverflowGuard('selection.notify', cb);
|
|
884
880
|
}
|
|
885
881
|
}
|
|
886
882
|
// Resolve pane geometry after scroll/viewport translations: the old row
|
|
@@ -124,6 +124,9 @@ export type FollowScroll = {
|
|
|
124
124
|
export type ViewportResize = FollowScroll & {
|
|
125
125
|
/** Geometry kind: chrome edge change or a same-height viewport move. */
|
|
126
126
|
kind: 'edge-resize' | 'translate';
|
|
127
|
+
/** Signed screen-row movement of the ScrollBox itself this frame. Edge
|
|
128
|
+
* changes alone are 0; a chrome row mounting above the box moves it. */
|
|
129
|
+
boxDeltaY?: number;
|
|
127
130
|
/** Screen-row movement for a `translate`; 0 for an edge resize. */
|
|
128
131
|
rowDelta: number;
|
|
129
132
|
/** Viewport bounds BEFORE this frame's layout (= the frontFrame's). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-node-to-output.d.ts","sourceRoot":"","sources":["../../../src/ink/render-node-to-output.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAG1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AASrD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,KAAK,EAAkB,MAAM,aAAa,CAAA;AAiCxD,6CAA6C;AAC7C,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED;;;GAGG;AACH,wBAA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IAAI,cAAc,EAAE,CAIzD;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,EAAE,CAIpD;AAoFD;;;;;GAKG;AACH,iBAAS,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CASlE;AAED;;;;;;;;;;;;;GAaG;AACH,iBAAS,wBAAwB,CAC/B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,aAAa,EAAE,EACzB,aAAa,EAAE,MAAM,EAAE,EACvB,aAAa,EAAE,MAAM,EACrB,WAAW,GAAE,OAAe,EAC5B,QAAQ,CAAC,EAAE,YAAY,EAAE,GACxB,MAAM,CA2GR;AAoTD;;;;;;;;;GASG;AACH,iBAAS,kBAAkB,CACzB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAM9B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,wBAAwB,CAAC,EAAE,KAAK,CAAA;CACjC,GACA,IAAI,CA0xCN;AA4PD,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,CAAA;AAE1D,eAAe,kBAAkB,CAAA"}
|
|
@@ -1180,7 +1180,10 @@ function renderNodeToOutput(node, output, options) {
|
|
|
1180
1180
|
// Absolute screen-buffer row where the scrollable area (inside
|
|
1181
1181
|
// padding) begins. Exposed via ScrollBoxHandle.getViewportTop() so
|
|
1182
1182
|
// drag-to-scroll can detect when the drag leaves the scroll viewport.
|
|
1183
|
-
|
|
1183
|
+
const boxY = y1 ?? y;
|
|
1184
|
+
const boxDeltaY = node.scrollBoxY === undefined ? 0 : boxY - node.scrollBoxY;
|
|
1185
|
+
node.scrollBoxY = boxY;
|
|
1186
|
+
node.scrollViewportTop = boxY + padTop;
|
|
1184
1187
|
// Viewport-edges change with no scroll delta (chrome mount/unmount
|
|
1185
1188
|
// around the box) — recorded for the selection translate in ink.tsx.
|
|
1186
1189
|
// prevViewportTop defined ⇒ a previous frame wrote both bounds, so
|
|
@@ -1190,7 +1193,7 @@ function renderNodeToOutput(node, output, options) {
|
|
|
1190
1193
|
const screenRowOffset = prevViewportTop !== undefined &&
|
|
1191
1194
|
classifyViewportChange(prevViewportTop, prevViewportTop + prevInnerHeight - 1, node.scrollViewportTop, viewportBottom) === 'translate'
|
|
1192
1195
|
? node.scrollViewportTop - prevViewportTop
|
|
1193
|
-
:
|
|
1196
|
+
: boxDeltaY;
|
|
1194
1197
|
if (prevViewportTop !== undefined &&
|
|
1195
1198
|
(node.scrollViewportTop !== prevViewportTop ||
|
|
1196
1199
|
viewportBottom !== prevViewportTop + prevInnerHeight - 1)) {
|
|
@@ -1203,6 +1206,7 @@ function renderNodeToOutput(node, output, options) {
|
|
|
1203
1206
|
viewportRight: Math.floor(x + width) - 1,
|
|
1204
1207
|
viewportBottom: prevViewportBottom,
|
|
1205
1208
|
kind,
|
|
1209
|
+
boxDeltaY,
|
|
1206
1210
|
rowDelta: kind === 'translate' ? node.scrollViewportTop - prevViewportTop : 0,
|
|
1207
1211
|
prevTop: prevViewportTop,
|
|
1208
1212
|
prevBottom: prevViewportBottom,
|
|
@@ -1227,6 +1231,8 @@ function renderNodeToOutput(node, output, options) {
|
|
|
1227
1231
|
if (anchorTop != null) {
|
|
1228
1232
|
node.scrollTop = anchorTop + node.scrollAnchor.offset;
|
|
1229
1233
|
node.pendingScrollDelta = undefined;
|
|
1234
|
+
node.scrollFollowPending = false;
|
|
1235
|
+
node.scrollPaintedTop = undefined;
|
|
1230
1236
|
}
|
|
1231
1237
|
node.scrollAnchor = undefined;
|
|
1232
1238
|
}
|
|
@@ -1290,18 +1296,10 @@ function renderNodeToOutput(node, output, options) {
|
|
|
1290
1296
|
node.onStickyRestore?.();
|
|
1291
1297
|
}
|
|
1292
1298
|
}
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
delta: followDelta,
|
|
1298
|
-
viewportTop: vpTop,
|
|
1299
|
-
viewportLeft: Math.floor(x),
|
|
1300
|
-
viewportRight: Math.floor(x + width) - 1,
|
|
1301
|
-
viewportBottom: vpTop + innerHeight - 1,
|
|
1302
|
-
screenRowOffset,
|
|
1303
|
-
});
|
|
1304
|
-
}
|
|
1299
|
+
// Selection follow is recorded after the paint clamp below: the
|
|
1300
|
+
// requested scrollTop may run ahead of the mounted window, and
|
|
1301
|
+
// translating a selection by the requested delta would capture rows
|
|
1302
|
+
// that are still on screen (duplicate copy rows).
|
|
1305
1303
|
// Drain pendingScrollDelta. Native terminals (proportional burst
|
|
1306
1304
|
// events) use proportional drain; xterm.js (VS Code, sparse events +
|
|
1307
1305
|
// app-side accel curve) uses adaptive small-step drain. isXtermJs()
|
|
@@ -1310,6 +1308,11 @@ function renderNodeToOutput(node, output, options) {
|
|
|
1310
1308
|
// startup) the probe has resolved — same timing guarantee the
|
|
1311
1309
|
// wheel-accel curve relies on.
|
|
1312
1310
|
let cur = node.scrollTop ?? 0;
|
|
1311
|
+
// An explicit jump resets scrollPaintedTop. Resolve its baseline after
|
|
1312
|
+
// anchor/bottom positioning but before a same-batch wheel is drained.
|
|
1313
|
+
const followOrigin = node.scrollPaintedTop === undefined
|
|
1314
|
+
? shrunk && !sticky ? cur : Math.max(0, Math.min(cur, maxScroll))
|
|
1315
|
+
: scrollTopBeforeFollow;
|
|
1313
1316
|
const pending = node.pendingScrollDelta;
|
|
1314
1317
|
const cMin = node.scrollClampMin;
|
|
1315
1318
|
const cMax = node.scrollClampMax;
|
|
@@ -1379,6 +1382,43 @@ function renderNodeToOutput(node, output, options) {
|
|
|
1379
1382
|
node.pendingScrollDelta = undefined;
|
|
1380
1383
|
if (node.pendingScrollDelta !== undefined)
|
|
1381
1384
|
scrollDrainNode = node;
|
|
1385
|
+
// Selection follow: translate by what this frame actually painted,
|
|
1386
|
+
// not by the requested scrollTop. The virtual-scroll clamp may hold
|
|
1387
|
+
// the paint at the mounted-window edge for several frames while the
|
|
1388
|
+
// drain runs; the deferred remainder is emitted on the frame the
|
|
1389
|
+
// paint catches up, exactly once (scrollFollowPending).
|
|
1390
|
+
const nominalDelta = scrollTop - followOrigin;
|
|
1391
|
+
const previousPaintedTop = node.scrollPaintedTop ?? followOrigin;
|
|
1392
|
+
if (nominalDelta !== 0)
|
|
1393
|
+
node.scrollFollowPending = true;
|
|
1394
|
+
// A jump can itself remain behind the mount clamp. Only progress
|
|
1395
|
+
// between its baseline and the wheel target belongs to the new
|
|
1396
|
+
// follow; catching up the jump must not become deferred wheel debt.
|
|
1397
|
+
const followedTop = clamped < Math.min(previousPaintedTop, scrollTop) ||
|
|
1398
|
+
clamped > Math.max(previousPaintedTop, scrollTop)
|
|
1399
|
+
? previousPaintedTop
|
|
1400
|
+
: clamped;
|
|
1401
|
+
const paintedDelta = followedTop - previousPaintedTop;
|
|
1402
|
+
node.scrollPaintedTop = followedTop;
|
|
1403
|
+
if (node.scrollFollowPending && paintedDelta !== 0) {
|
|
1404
|
+
const followVpTop = node.scrollViewportTop ?? 0;
|
|
1405
|
+
followScrolls.push({
|
|
1406
|
+
delta: paintedDelta,
|
|
1407
|
+
viewportTop: followVpTop,
|
|
1408
|
+
viewportLeft: Math.floor(x),
|
|
1409
|
+
viewportRight: Math.floor(x + width) - 1,
|
|
1410
|
+
viewportBottom: followVpTop + innerHeight - 1,
|
|
1411
|
+
screenRowOffset,
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
// Painted position caught up with the requested one and the drain is
|
|
1415
|
+
// empty: no deferred selection delta remains. Explicit jumps reset the
|
|
1416
|
+
// baseline, so only a later wheel can establish new follow debt.
|
|
1417
|
+
if (node.scrollFollowPending &&
|
|
1418
|
+
clamped === scrollTop &&
|
|
1419
|
+
(node.pendingScrollDelta ?? 0) === 0) {
|
|
1420
|
+
node.scrollFollowPending = false;
|
|
1421
|
+
}
|
|
1382
1422
|
// Geometry forensics (#421/#433): everything that decides where this
|
|
1383
1423
|
// viewport painted — captured AFTER all clamps so the trace shows the
|
|
1384
1424
|
// final renderScrollTop, not the requested one.
|
|
@@ -1401,32 +1441,6 @@ function renderNodeToOutput(node, output, options) {
|
|
|
1401
1441
|
clampMax: cMax ?? null,
|
|
1402
1442
|
});
|
|
1403
1443
|
}
|
|
1404
|
-
// Wheel-drain selection translate (#438): the drain moved content
|
|
1405
|
-
// by (scrollTop - scrollTopBeforeFollow) rows this frame, minus
|
|
1406
|
-
// what at-bottom follow already reported above (followDelta is 0
|
|
1407
|
-
// unless the follow branch fired — and when it did, it cleared
|
|
1408
|
-
// pendingScrollDelta, so the drain contributed nothing). Record
|
|
1409
|
-
// the remainder as a follow-scroll event with a SIGNED delta so
|
|
1410
|
-
// ink.tsx re-anchors any active selection to the text. Without
|
|
1411
|
-
// this, wheel scrolling leaves the highlight pinned to screen
|
|
1412
|
-
// rows and copy-on-select grabs whatever scrolled under it.
|
|
1413
|
-
// scrollTo/scrollToElement jumps never contribute: they write
|
|
1414
|
-
// scrollTop before scrollTopBeforeFollow is captured. Multi-frame
|
|
1415
|
-
// drains record per-frame portions; the selection's virtual-row
|
|
1416
|
-
// tracking accumulates the clamp overshoot across frames. Multiple
|
|
1417
|
-
// boxes may each record; ink.tsx attributes by viewport containment.
|
|
1418
|
-
const wheelDelta = scrollTop - scrollTopBeforeFollow - followDelta;
|
|
1419
|
-
if (wheelDelta !== 0) {
|
|
1420
|
-
const wheelVpTop = node.scrollViewportTop ?? 0;
|
|
1421
|
-
followScrolls.push({
|
|
1422
|
-
delta: wheelDelta,
|
|
1423
|
-
viewportTop: wheelVpTop,
|
|
1424
|
-
viewportLeft: Math.floor(x),
|
|
1425
|
-
viewportRight: Math.floor(x + width) - 1,
|
|
1426
|
-
viewportBottom: wheelVpTop + innerHeight - 1,
|
|
1427
|
-
screenRowOffset,
|
|
1428
|
-
});
|
|
1429
|
-
}
|
|
1430
1444
|
// A manual scroll that lands exactly on the bottom re-pins sticky
|
|
1431
1445
|
// IMMEDIATELY on this frame — the follow-block restore above only
|
|
1432
1446
|
// fires when a later frame happens, but an idle stream (turn done,
|
|
@@ -85,6 +85,17 @@ export type SelectionState = {
|
|
|
85
85
|
virtualAnchorRow?: number;
|
|
86
86
|
/** Same for focus. */
|
|
87
87
|
virtualFocusRow?: number;
|
|
88
|
+
/** Pre-clamp anchor column, restored when a reverse scroll brings the
|
|
89
|
+
* captured anchor row back into the viewport. Without it a selection
|
|
90
|
+
* that scrolled fully off and back keeps the edge column (0 / width-1),
|
|
91
|
+
* truncating the first/last copied line. */
|
|
92
|
+
virtualAnchorCol?: number;
|
|
93
|
+
/** Same for focus. */
|
|
94
|
+
virtualFocusCol?: number;
|
|
95
|
+
/** Both endpoints are past the same viewport edge. The whole selection
|
|
96
|
+
* lives in scrolledOffAbove/Below; getSelectedText must not also read the
|
|
97
|
+
* clamped edge row, which now belongs to new content. */
|
|
98
|
+
offScreen?: 'above' | 'below';
|
|
88
99
|
/** Viewport bounds recorded by the LAST in-drag follow shift. During an
|
|
89
100
|
* active drag a wheel that pushes both ends off the same edge CLAMPS
|
|
90
101
|
* instead of clearing (the gesture must survive); finishSelection then
|
|
@@ -262,29 +273,30 @@ export type FocusMove = 'left' | 'right' | 'up' | 'down' | 'lineStart' | 'lineEn
|
|
|
262
273
|
*/
|
|
263
274
|
export declare function moveFocus(s: SelectionState, col: number, row: number): void;
|
|
264
275
|
/**
|
|
265
|
-
* Shift
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
276
|
+
* Shift the selection by dRow, clamped to [minRow, maxRow]. Used by keyboard
|
|
277
|
+
* scroll (PgUp/PgDn/ctrl+u/d/b/f) and by the renderer's selection-follow
|
|
278
|
+
* pass. A released selection moves BOTH ends (text-anchored); a live drag
|
|
279
|
+
* passes moveFocus=false so only the anchor tracks the text and the focus
|
|
280
|
+
* stays under the held pointer. Any point that hits a clamp bound gets its
|
|
281
|
+
* col reset to the full-width edge — its original content scrolled off-screen
|
|
282
|
+
* and was captured by captureScrolledRows. The original column is kept in
|
|
283
|
+
* virtualAnchorCol/virtualFocusCol and restored when a reverse scroll brings
|
|
284
|
+
* that row back.
|
|
285
|
+
*
|
|
286
|
+
* allowClear=false keeps a selection that scrolled fully off-screen: the
|
|
287
|
+
* captured rows stay copyable and a reverse scroll restores the endpoints.
|
|
288
|
+
* The live-drag path uses it so a wheel cannot kill the gesture; the
|
|
289
|
+
* released path also uses it so the user can copy after scrolling away.
|
|
274
290
|
*
|
|
275
|
-
* If both ends overshoot the SAME viewport edge (select text → Home/End/g/G
|
|
276
|
-
* jumps far enough that both are out of view), clear — otherwise both clamp
|
|
277
|
-
* to the same corner cell and a ghost 1-cell highlight lingers, and
|
|
278
|
-
* getSelectedText returns one unrelated char from that corner. Symmetric
|
|
279
|
-
* with shiftSelectionForFollow's top-edge check, but bidirectional: keyboard
|
|
280
|
-
* scroll can jump either way.
|
|
281
291
|
* @param s - the selection state to mutate.
|
|
282
292
|
* @param dRow - signed row offset to shift by.
|
|
283
293
|
* @param minRow - lowest allowed row (viewport top).
|
|
284
294
|
* @param maxRow - highest allowed row (viewport bottom).
|
|
285
295
|
* @param width - screen width, used for the clamp-edge column.
|
|
296
|
+
* @param allowClear - clear when both ends leave the same edge (default true).
|
|
297
|
+
* @param moveFocus - also move focus (false for a live drag).
|
|
286
298
|
*/
|
|
287
|
-
export declare function shiftSelection(s: SelectionState, dRow: number, minRow: number, maxRow: number, width: number): void;
|
|
299
|
+
export declare function shiftSelection(s: SelectionState, dRow: number, minRow: number, maxRow: number, width: number, allowClear?: boolean, moveFocus?: boolean): void;
|
|
288
300
|
/**
|
|
289
301
|
* Shift the anchor row by dRow, clamped to [minRow, maxRow]. Used during
|
|
290
302
|
* drag-to-scroll: when the ScrollBox scrolls by N rows, the content that
|
|
@@ -377,16 +389,12 @@ export declare function shiftSelectionForViewportTranslation(s: SelectionState,
|
|
|
377
389
|
* before this frame's paint overwrites it with chrome cells. Growth edges
|
|
378
390
|
* have no band to capture; the shift below just re-widens the clamp.
|
|
379
391
|
*
|
|
380
|
-
* shiftSelection
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
* shiftSelection for BOTH drag and released states: with dRow=0 a live drag
|
|
387
|
-
* focus stays at the mouse unless the chrome covered it too, and
|
|
388
|
-
* shiftSelection is the only shift that pops debt on re-widening — the
|
|
389
|
-
* follow path never re-widens, a resize does (pill unmount).
|
|
392
|
+
* shiftSelection then re-clamps the logical endpoints to the new bounds.
|
|
393
|
+
* A box move translates the text anchor; a live focus stays at the pointer
|
|
394
|
+
* unless chrome covered its row. Captured rows are popped only as their
|
|
395
|
+
* selected span actually re-enters. A released, previously visible selection
|
|
396
|
+
* wholly covered by chrome still clears; an already retained off-screen
|
|
397
|
+
* selection survives valid geometry changes.
|
|
390
398
|
*
|
|
391
399
|
* Degenerate bounds are handled explicitly: a collapsed new viewport
|
|
392
400
|
* (innerHeight 0 — chrome taller than the box) clears the selection, an
|
|
@@ -400,7 +408,7 @@ export declare function shiftSelectionForViewportTranslation(s: SelectionState,
|
|
|
400
408
|
* @param newTop - viewport top after this frame's layout.
|
|
401
409
|
* @param newBottom - viewport bottom after this frame's layout.
|
|
402
410
|
*/
|
|
403
|
-
export declare function shiftSelectionForViewportResize(s: SelectionState, screen: Screen, oldTop: number, oldBottom: number, newTop: number, newBottom: number): void;
|
|
411
|
+
export declare function shiftSelectionForViewportResize(s: SelectionState, screen: Screen, oldTop: number, oldBottom: number, newTop: number, newBottom: number, boxDeltaY?: number): void;
|
|
404
412
|
/** A scroll event reported by a ScrollBox this frame (follow or wheel
|
|
405
413
|
* drain): signed delta plus the box's viewport bounds. Structurally
|
|
406
414
|
* identical to FollowScroll in render-node-to-output. */
|
|
@@ -555,8 +563,10 @@ export declare function getSelectedText(s: SelectionState, screen: Screen): stri
|
|
|
555
563
|
* @param firstRow - first viewport row that is about to scroll out.
|
|
556
564
|
* @param lastRow - last viewport row that is about to scroll out.
|
|
557
565
|
* @param side - which viewport edge the rows scroll out of.
|
|
566
|
+
* @param screenRowOffset - capture rows minus this offset index the previous screen.
|
|
567
|
+
* @param focusRowOffset - map a screen-local drag focus back across the pending shift.
|
|
558
568
|
*/
|
|
559
|
-
export declare function captureScrolledRows(s: SelectionState, screen: Screen, firstRow: number, lastRow: number, side: 'above' | 'below', screenRowOffset?: number): void;
|
|
569
|
+
export declare function captureScrolledRows(s: SelectionState, screen: Screen, firstRow: number, lastRow: number, side: 'above' | 'below', screenRowOffset?: number, focusRowOffset?: number): void;
|
|
560
570
|
/**
|
|
561
571
|
* Resolve the focus-side edge of the visible selection. Blank rows and
|
|
562
572
|
* padding cannot own a native cursor; step toward the anchor until selected
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../src/ink/selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAGjE,KAAK,KAAK,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAEzC;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB;;+CAE2C;IAC3C,QAAQ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