Problem
The unified diff toolbar provides an action to open the diff in the traditional 2-way compare editor. Conversely, the 2-way compare editor provides an action to switch back to the unified diff presentation. However, switching between the two presentations does not preserve context: the cursor position, scroll position, and the currently active diff hunk are lost, and the view always resets to the first diff.
Expected Behavior
When switching between unified diff and 2-way compare editor (in either direction), the following context should be restored in the target presentation:
- The active diff hunk — the diff closest to the cursor or the one explicitly navigated to should remain selected/focused.
- The cursor position — the caret should be placed at the equivalent location in the target editor.
- The scroll position — the target editor should scroll to bring the active diff into view.
This makes switching between presentations a non-destructive operation and allows users to freely alternate between the two views without losing their place.
Problem
The unified diff toolbar provides an action to open the diff in the traditional 2-way compare editor. Conversely, the 2-way compare editor provides an action to switch back to the unified diff presentation. However, switching between the two presentations does not preserve context: the cursor position, scroll position, and the currently active diff hunk are lost, and the view always resets to the first diff.
Expected Behavior
When switching between unified diff and 2-way compare editor (in either direction), the following context should be restored in the target presentation:
This makes switching between presentations a non-destructive operation and allows users to freely alternate between the two views without losing their place.