Skip to content

Shell V2 Improvements: History Blocks, Autocomplete, and Redraw Fixes#1817

Merged
KCarretto merged 1 commit intofeat/shellv2from
shellv2-fixes-2643302927973838620
Feb 16, 2026
Merged

Shell V2 Improvements: History Blocks, Autocomplete, and Redraw Fixes#1817
KCarretto merged 1 commit intofeat/shellv2from
shellv2-fixes-2643302927973838620

Conversation

@KCarretto
Copy link
Copy Markdown
Collaborator

This change addresses several usability issues in the Shell V2 REPL:

  1. Ctrl+L: Previously, clearing the screen caused the prompt to be duplicated. This is fixed by using \x1b[2J\x1b[H to clear the screen and move the cursor to the top-left corner before redrawing the prompt.
  2. History Search: Previously, history search only recalled individual lines. Now, the REPL accumulates multi-line input (e.g., function definitions) into a currentBlock and only pushes to history when the interpreter signals the input is complete. This allows users to recall full code blocks.
  3. Autocomplete:
    • Autocomplete now triggers automatically when typing . (e.g., file.).
    • The menu remains open while typing to allow filtering.
    • Fixed an issue where cycling through completions with Tab could go out of bounds or fail to loop correctly.
  4. Redraw Logic: The redrawLine function was rewritten to correctly handle multi-line input buffers by tracking the previous render height and using ANSI escape sequences to clear the correct number of lines before redrawing.

Verification:

  • npm test passed (no regressions).
  • Frontend verification script confirmed the component renders and initializes correctly.
  • Code review confirmed logic correctness.

PR created automatically by Jules for task 2643302927973838620 started by @KCarretto

- Fix duplicated prompt on Ctrl+L by using explicit ANSI clear+home sequence.
- Implement multi-line history support by accumulating input blocks until complete.
- Improve autocomplete: trigger on '.', allow typing while open, and fix looping index.
- Refactor redrawLine to support multi-line buffers.

Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@KCarretto KCarretto marked this pull request as ready for review February 16, 2026 21:07
@KCarretto KCarretto merged commit b53712c into feat/shellv2 Feb 16, 2026
@KCarretto KCarretto deleted the shellv2-fixes-2643302927973838620 branch February 16, 2026 21:07
github-merge-queue bot pushed a commit that referenced this pull request Feb 17, 2026
* Implement Headless REPL Architecture with WASM and Shell V2 UI (#1811)

* Implement Headless REPL Architecture with WASM and Shell V2 UI

- Add `HeadlessRepl` to `eldritch-wasm` for input buffering and parsing.
- Create `headless-adapter.ts` for frontend WASM/WebSocket integration.
- Implement `/shellv2` page with xterm.js.
- Add `/shellv2/ws` dummy backend route.
- Fix WASM build dependencies in `eldritch` libraries.

Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

* Implement Headless REPL with WASM, Shell V2 UI, Indentation, and Autocompletion

- Add `HeadlessRepl` struct to `eldritch-wasm` with input buffering and fake library bindings for completion.
- Create `HeadlessWasmAdapter` in frontend to bridge WASM and WebSocket.
- Implement `/shellv2` page using xterm.js with support for indentation (Tab key) and autocompletion display.
- Add dummy backend route `/shellv2/ws` in `tavern` for echo testing.
- Update build scripts to deploy WASM artifacts to public assets.
- Fix dependencies in `eldritch` libraries for WASM compatibility.

Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

* Enhance Shell V2 with completion, history search, and robust input handling (#1816)

* Implement enhanced Shell V2 features: completion dropdown, history search, and resizing

- Frontend:
    - Added `xterm-addon-fit` for responsive terminal resizing.
    - Implemented shell state management (input buffer, cursor, history).
    - Added key bindings: Ctrl+C (reset), Ctrl+L (clear), Ctrl+A/E (home/end), Ctrl+U/W (delete line/word).
    - Implemented Tab completion with a custom dropdown UI overlay.
    - Implemented Ctrl+R for basic reverse history search.
    - Updated `HeadlessWasmAdapter` to support `reset()` and structured completion results.

- Backend (`eldritch-wasm`):
    - Added `HeadlessRepl::reset()` to clear the internal buffer.
    - Updated `HeadlessRepl::complete()` to return `{ suggestions: [...], start: usize }` instead of a flat list, enabling correct inline replacement.
    - Added tests for reset and completion structure.
    - Rebuilt WASM artifacts with `fake_bindings` feature.

Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

* Fix Shell V2 cursor flicker, tab indent, and function termination

- **Cursor Flicker:** Optimized `redrawLine` to avoid clearing the entire line (including prompt) and rewrite only the input buffer using `\r` + content + `\x1b[K`. Added fast-path logic in `onData` for appending characters or backspacing at the end of the line, bypassing `redrawLine` entirely for the most common typing scenarios.
- **Tab Indenting:** Updated Tab handler to insert 4 spaces if the input buffer is empty or consists only of whitespace, enabling standard indentation behavior.
- **Function Termination:** Ensured `state.prompt` is reset to `>>> ` when a command returns `"complete"` status, fixing an issue where the prompt would remain `.. ` after finishing a multi-line function definition.

Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

* feat(shellv2): improve REPL history, autocomplete and redraw (#1817)

- Fix duplicated prompt on Ctrl+L by using explicit ANSI clear+home sequence.
- Implement multi-line history support by accumulating input blocks until complete.
- Improve autocomplete: trigger on '.', allow typing while open, and fix looping index.
- Refactor redrawLine to support multi-line buffers.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

* Fix ShellV2 REPL: reverse search, indentation, and scrolling (#1819)

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

* default font size and rebuild

* slight cleanup

* npm run build

* cargo fmt

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
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.

1 participant