From 3c186031beb37663d8006bb8a85d8a9215338aac Mon Sep 17 00:00:00 2001 From: Mathew Pareles Date: Sun, 30 Mar 2025 23:54:37 -0700 Subject: [PATCH] minor positional change --- .../void/browser/voidSelectionHelperWidget.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/voidSelectionHelperWidget.ts b/src/vs/workbench/contrib/void/browser/voidSelectionHelperWidget.ts index e3cd2d41..9dcac355 100644 --- a/src/vs/workbench/contrib/void/browser/voidSelectionHelperWidget.ts +++ b/src/vs/workbench/contrib/void/browser/voidSelectionHelperWidget.ts @@ -208,16 +208,14 @@ export class SelectionHelperContribution extends Disposable implements IEditorCo let boxPos = getBoxPosition(targetLine); // if the position of the box is too far to the right, keep searching for a good position - let attempt = 0; - const maxAttempts = 3; - outerLoop: while (boxPos.left > maxLeftPx && attempt < maxAttempts) { - attempt++ + const lineDeltasToTry = [-1, -2, -3, 1, 2, 3]; - const linesToTry = [targetLine - attempt, targetLine + attempt] - for (const line of linesToTry) { - boxPos = getBoxPosition(line); + if (boxPos.left > maxLeftPx) { + for (const lineDelta of lineDeltasToTry) { + + boxPos = getBoxPosition(targetLine + lineDelta); if (boxPos.left <= maxLeftPx) { - break outerLoop; + break; } } }