Skip to content

Commit 7582df6

Browse files
authored
Dictated text goes off screen when using voice commands. (fix microsoft#205783) (microsoft#205838)
1 parent 2411a9c commit 7582df6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/vs/workbench/contrib/codeEditor/browser/dictation/editorDictation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,11 @@ export class EditorDictation extends Disposable implements IEditorContribution {
199199
previewStart = assertIsDefined(this.editor.getPosition());
200200
}
201201

202+
const endPosition = new Position(previewStart.lineNumber, previewStart.column + text.length);
202203
this.editor.executeEdits(EditorDictation.ID, [
203204
EditOperation.replace(Range.fromPositions(previewStart, previewStart.with(undefined, previewStart.column + lastReplaceTextLength)), text)
204205
], [
205-
Selection.fromPositions(new Position(previewStart.lineNumber, previewStart.column + text.length))
206+
Selection.fromPositions(endPosition)
206207
]);
207208

208209
if (isPreview) {
@@ -225,6 +226,7 @@ export class EditorDictation extends Disposable implements IEditorContribution {
225226
lastReplaceTextLength = 0;
226227
}
227228

229+
this.editor.revealPositionInCenterIfOutsideViewport(endPosition);
228230
this.widget.layout();
229231
};
230232

0 commit comments

Comments
 (0)