Skip to content

Fix multi-range undo selection and restore lane status - #1357

Merged
KeithCu merged 2 commits into
masterfrom
fix-undo-selection-and-stream-status-922049502696162966
Oct 6, 2026
Merged

KeithCu merged 2 commits into
masterfrom
fix-undo-selection-and-stream-status-922049502696162966

Conversation

@KeithCu

@KeithCu KeithCu commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Fixes two bugs and updates docstrings:

  1. LibreOffice leaves a multi-range selection when a streamed edit is undone, with getByIndex(0) being an empty range at the end of the text. Because do_extend_selection and target_resolver blindly picked index 0, they would see an empty selection and misbehave. The fix introduces selected_text_range which correctly searches for the real selection.
  2. The "Waiting for another document's reply..." status was sticky and never reverted if the llm_request_lane lock was acquired. It now accepts and restores a resume_status.
  3. Updated docstrings for WriterCompoundUndo to clarify that the context stays open for the whole stream.

Also removed scratch files after review.


PR created automatically by Jules for task 922049502696162966 started by @KeithCu

…e waiting status in lane.

- Replaced hardcoded `getByIndex(0)` with `selected_text_range` in `plugin/writer/selection.py` which searches for the first non-empty text range. This resolves an issue where undoing a streamed edit leaves an empty range at index 0 and silently ignores `extend_selection` or inserts at the document end.
- Added `resume_status` in `llm_request_lane` so that if a "Waiting for another document's reply..." status is sent while blocking on the global lock, the correct status (e.g. "Thinking...") is restored once the lock is acquired.
- Updated `WriterCompoundUndo`, `WriterStreamedRewriteSession`, and `WriterStreamedAppendSession` docstrings to explain that the undo context intentionally stays open during streaming, grouping background user edits into the same undo step.
- Included comprehensive tests for selection multi-range skipping and lane status resumption.
@google-labs-jules

Copy link
Copy Markdown

👋 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.

@KeithCu
KeithCu merged commit 9487805 into master Oct 6, 2026
1 check passed
@KeithCu
KeithCu deleted the fix-undo-selection-and-stream-status-922049502696162966 branch October 7, 2026 20:43
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