Roo-Code/src/integrations/editor
Hannes Rudolph ede228e152
fix: prevent chatbox focus loss during automated file editing (#4574) (#5349)
* fix: prevent chatbox focus loss during automated file editing (#4574)

- Add preserveFocus: true to DiffViewProvider openDiffEditor method
- Implement comprehensive focus preservation during cursor positioning and scrolling
- Make scrollToFirstDiff async with focus restoration capabilities
- Update all tool files to use async scrollToFirstDiff
- Add comprehensive unit and E2E tests for focus preservation

Fixes #4574

* refactor: extract focus restoration logic and improve consistency

- Created restoreEditorFocus() helper method to eliminate code duplication
- Changed preserveFocus from false to true for consistent behavior
- Added error handling with silent logging for focus restoration failures
- Added null checks for undefined activeTextEditor cases

* Delete apps/vscode-e2e/src/suite/tools/focus-preservation.test.ts

It doesn't seem to be testing anything

* refactor: remove focus restoration logic to simplify diff editor interactions

* refactor: remove unnecessary await from scrollToFirstDiff calls

---------

Co-authored-by: Daniel <57051444+daniel-lxs@users.noreply.github.com>
Co-authored-by: Daniel Riccio <ricciodaniel98@gmail.com>
2025-07-03 20:43:06 -04:00
..
__tests__ fix: prevent chatbox focus loss during automated file editing (#4574) (#5349) 2025-07-03 20:43:06 -04:00
DecorationController.ts Chore: Prettier for consistant formatting (#794) 2024-11-21 13:13:54 -08:00
detect-omission.ts Prettier backfill 2025-01-17 14:11:28 -05:00
DiffViewProvider.ts fix: prevent chatbox focus loss during automated file editing (#4574) (#5349) 2025-07-03 20:43:06 -04:00
EditorUtils.ts Move presentAssistantMessage into its own module (#3345) 2025-05-08 11:59:03 -07:00