Skip to content

Conversation

@liangfung
Copy link
Contributor

Summary

This pull request addresses an issue where the active editor selection was lost when focus shifted to a Pochi webview panel.

The key changes include:

  • Modifying TabState to conditionally update the active selection, preserving it when focus moves to a webview.
  • Clearing the selection when the corresponding file tab is closed.
  • Reverting the now-redundant preserveFocus changes in PochiWebviewPanel.

Test plan

  1. Open a text file in the editor and select some text.
  2. Open the Pochi webview (e.g., by creating a new task).
  3. Verify that the text selection in the original editor is preserved.
  4. Close the text editor tab.
  5. Verify that the selection is now cleared.

🤖 Generated with Pochi

This commit modifies the selection handling logic in `TabState` to correctly preserve the last active editor selection when focus is moved to a Pochi webview panel.

- `onTabChanged` and `onSelectionChanged` now only update the active selection if a new valid selection is found.
- `onTabChanged` also clears the selection if the corresponding file tab is closed.

This approach makes the previous changes to `preserveFocus` in `PochiWebviewPanel` redundant, so those changes have been reverted.

🤖 Generated with [Pochi](https://getpochi.com)

Co-Authored-By: Pochi <noreply@getpochi.com>
@wsxiaoys wsxiaoys requested a review from zhanba October 31, 2025 10:13
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