mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
fix: always center cursor position after closing diff view
Changed from InCenterIfOutsideViewport to InCenter to ensure the cursor position is always properly centered when returning from the diff viewer, regardless of whether VS Code considers it "visible" or not. This fixes the issue where clicking reject would not properly scroll to the last viewed position in the diff viewer.
This commit is contained in:
parent
9e57dd652a
commit
7e41855f7a
2 changed files with 9 additions and 9 deletions
|
|
@ -232,12 +232,12 @@ export class DiffViewProvider {
|
|||
// Then reveal the range to ensure it's visible
|
||||
if (selection && !selection.isEmpty) {
|
||||
// If there's an actual selection, reveal it
|
||||
editor.revealRange(selection, vscode.TextEditorRevealType.InCenterIfOutsideViewport)
|
||||
editor.revealRange(selection, vscode.TextEditorRevealType.InCenter)
|
||||
} else if (selection) {
|
||||
// If just a cursor position, reveal that position
|
||||
editor.revealRange(
|
||||
new vscode.Range(selection.active, selection.active),
|
||||
vscode.TextEditorRevealType.InCenterIfOutsideViewport,
|
||||
vscode.TextEditorRevealType.InCenter,
|
||||
)
|
||||
} else if (visibleRanges && visibleRanges.length > 0) {
|
||||
// Fallback to visible ranges if no selection
|
||||
|
|
@ -462,12 +462,12 @@ export class DiffViewProvider {
|
|||
// Then reveal the range to ensure it's visible
|
||||
if (selection && !selection.isEmpty) {
|
||||
// If there's an actual selection, reveal it
|
||||
editor.revealRange(selection, vscode.TextEditorRevealType.InCenterIfOutsideViewport)
|
||||
editor.revealRange(selection, vscode.TextEditorRevealType.InCenter)
|
||||
} else if (selection) {
|
||||
// If just a cursor position, reveal that position
|
||||
editor.revealRange(
|
||||
new vscode.Range(selection.active, selection.active),
|
||||
vscode.TextEditorRevealType.InCenterIfOutsideViewport,
|
||||
vscode.TextEditorRevealType.InCenter,
|
||||
)
|
||||
} else if (visibleRanges && visibleRanges.length > 0) {
|
||||
// Fallback to visible ranges if no selection
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ describe("DiffViewProvider", () => {
|
|||
start: { line: 18, character: 10 },
|
||||
end: { line: 18, character: 10 },
|
||||
}),
|
||||
vscode.TextEditorRevealType.InCenterIfOutsideViewport,
|
||||
vscode.TextEditorRevealType.InCenter,
|
||||
)
|
||||
|
||||
expect(result.newProblemsMessage).toBe("")
|
||||
|
|
@ -623,7 +623,7 @@ describe("DiffViewProvider", () => {
|
|||
// Verify the full selection range was revealed
|
||||
expect(mockEditor.revealRange).toHaveBeenCalledWith(
|
||||
selectionWithRange,
|
||||
vscode.TextEditorRevealType.InCenterIfOutsideViewport,
|
||||
vscode.TextEditorRevealType.InCenter,
|
||||
)
|
||||
|
||||
expect(result.newProblemsMessage).toBe("")
|
||||
|
|
@ -665,7 +665,7 @@ describe("DiffViewProvider", () => {
|
|||
start: { line: 18, character: 10 },
|
||||
end: { line: 18, character: 10 },
|
||||
}),
|
||||
vscode.TextEditorRevealType.InCenterIfOutsideViewport,
|
||||
vscode.TextEditorRevealType.InCenter,
|
||||
)
|
||||
})
|
||||
|
||||
|
|
@ -682,7 +682,7 @@ describe("DiffViewProvider", () => {
|
|||
start: { line: 18, character: 10 },
|
||||
end: { line: 18, character: 10 },
|
||||
}),
|
||||
vscode.TextEditorRevealType.InCenterIfOutsideViewport,
|
||||
vscode.TextEditorRevealType.InCenter,
|
||||
)
|
||||
|
||||
expect(result.newProblemsMessage).toBe("")
|
||||
|
|
@ -701,7 +701,7 @@ describe("DiffViewProvider", () => {
|
|||
start: { line: 18, character: 10 },
|
||||
end: { line: 18, character: 10 },
|
||||
}),
|
||||
vscode.TextEditorRevealType.InCenterIfOutsideViewport,
|
||||
vscode.TextEditorRevealType.InCenter,
|
||||
)
|
||||
|
||||
expect(result.newProblemsMessage).toBe("")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue