Skip to content

fix: multi-line support in the interactive shell#591

Merged
tnaum-ms merged 6 commits intorel/release_0.8.0from
dev/tnaum/bug-multiline
Apr 17, 2026
Merged

fix: multi-line support in the interactive shell#591
tnaum-ms merged 6 commits intorel/release_0.8.0from
dev/tnaum/bug-multiline

Conversation

@tnaum-ms
Copy link
Copy Markdown
Collaborator

…lInputHandler

@tnaum-ms tnaum-ms requested a review from a team as a code owner April 17, 2026 12:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the Interactive Shell editing experience by making cursor movement and re-rendering wrap-aware (including deferred-wrap edge cases) and by adding multi-line paste handling with a configurable behavior and optional user prompt.

Changes:

  • Track cursor row across renders and use full re-rendering for Left/Right/Home/End to correctly cross wrapped-row boundaries.
  • Add multi-line paste detection in the PTY with a new documentDB.shell.multiLinePasteBehavior setting and an optional QuickPick prompt.
  • Expand Jest coverage for line-wrapping/editing behavior and multi-line paste flows; update VS Code mocks and localization bundle.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/documentdb/shell/ShellInputHandler.ts Adds _lastCursorRow tracking and wrap/deferred-wrap-aware cursor repositioning; switches cursor navigation to re-rendering.
src/documentdb/shell/ShellInputHandler.test.ts Updates navigation assertions and adds extensive wrap/deferred-wrap regression tests.
src/documentdb/shell/DocumentDBShellPty.ts Detects multi-line paste, consults new setting, and optionally prompts user to join/execute/cancel.
src/documentdb/shell/DocumentDBShellPty.test.ts Updates configuration mocking and adds tests for dialog behavior and paste execution modes.
src/mocks/vscode.js Adds QuickPickItemKind to support separator items in tests.
package.json Introduces documentDB.shell.multiLinePasteBehavior configuration contribution.
l10n/bundle.l10n.json Adds localized strings for the new QuickPick UI.

Comment thread src/documentdb/shell/ShellInputHandler.ts
Comment thread src/documentdb/shell/DocumentDBShellPty.test.ts
When the terminal is resized, xterm.js reflows content but
_lastCursorRow was not updated, causing reRenderLine() to navigate
to the wrong prompt row. Reset it to 0 in setColumns().
Change .filter((l) => l.length > 0) to .filter((l) => l.trim().length > 0)
so that whitespace-only lines are excluded. Previously, a paste like
"db.test\n   \n.find()" would produce a spurious double space.
mockPasteBehavior() now preserves documentDB.shell.display.colorOutput=false
alongside documentDB.timeout, preventing brittleness if paste tests ever
check rendered ANSI output.
@tnaum-ms
Copy link
Copy Markdown
Collaborator Author

Fixed whitespace-only line handling in 4ee502cf — changed .filter((l) => l.length > 0) to .filter((l) => l.trim().length > 0) in handleMultiLinePaste() so that whitespace-only lines are excluded. Previously pasting "db.test\n \n.find()" would produce a spurious double space instead of "db.test.find()".

@tnaum-ms tnaum-ms merged commit 7f9830a into rel/release_0.8.0 Apr 17, 2026
2 checks passed
@tnaum-ms tnaum-ms deleted the dev/tnaum/bug-multiline branch April 17, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants