Skip to content

Commit 22707da

Browse files
committed
Filter out emojis
1 parent 922ee6a commit 22707da

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/subcommands/chat/react/ChatInput.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,15 @@ export const ChatInput = ({
302302
return;
303303
}
304304

305+
// Filter out emojis and non-printable characters
306+
const filteredInputChunk = normalizedInputChunk.replace(/[^\x20-\x7E\n]/g, "");
307+
308+
if (filteredInputChunk.length === 0) {
309+
return;
310+
}
311+
305312
setUserInputState(previousState =>
306-
insertTextAtCursor({ state: previousState, text: normalizedInputChunk }),
313+
insertTextAtCursor({ state: previousState, text: filteredInputChunk }),
307314
);
308315
}
309316
});

0 commit comments

Comments
 (0)