Skip to content

Commit 74f9854

Browse files
committed
Refactor symbol replacement logic in TerminalSpeechToTextSession
1 parent b67e7f7 commit 74f9854

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/vs/workbench/contrib/terminal/browser/terminalSpeechToText.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,8 @@ export class TerminalSpeechToTextSession extends Disposable {
140140
private _updateInput(e: ISpeechToTextEvent): void {
141141
if (e.text) {
142142
let input = e.text.replaceAll(/[.,?;!]/g, '');
143-
144-
for (const symbol of Object.values(symbolMap)) {
145-
const regex: RegExp = new RegExp(symbol + '\b');
146-
input = input.replace(regex, symbolMap[symbol]);
143+
for (const symbol of Object.entries(symbolMap)) {
144+
input = input.replace(new RegExp('\\b' + symbol[0] + '\\b'), symbol[1]);
147145
}
148146
this._input = ' ' + input;
149147
}

0 commit comments

Comments
 (0)