From e0b90b2ea552a2b53ffd3bb4677aea17a01c6d64 Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Thu, 9 Jan 2025 12:46:23 -0800 Subject: [PATCH] Revert "Fix the chat context menu removing UTF8 characters causing pure UTF8 character filenames not to display in the menu (#1145)" This reverts commit 1f2acc519bc71bd8f38f4df87af0e07876cba0f6. --- webview-ui/src/components/chat/ChatRow.tsx | 4 ++-- webview-ui/src/components/chat/ContextMenu.tsx | 4 ++-- webview-ui/src/components/common/CodeAccordian.tsx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index edbb1e147a..fc3c32e66b 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -16,7 +16,7 @@ import { useExtensionState } from "../../context/ExtensionStateContext" import { findMatchingResourceOrTemplate } from "../../utils/mcp" import { vscode } from "../../utils/vscode" import { CheckpointControls, CheckpointOverlay } from "../common/CheckpointControls" -import CodeAccordian, { cleanPathPrefix } from "../common/CodeAccordian" +import CodeAccordian, { removeLeadingNonAlphanumeric } from "../common/CodeAccordian" import CodeBlock, { CODE_BLOCK_BG_COLOR } from "../common/CodeBlock" import MarkdownBlock from "../common/MarkdownBlock" import SuccessButton from "../common/SuccessButton" @@ -427,7 +427,7 @@ export const ChatRowContent = ({ message, isExpanded, onToggleExpand, lastModifi direction: "rtl", textAlign: "left", }}> - {cleanPathPrefix(tool.path ?? "") + "\u200E"} + {removeLeadingNonAlphanumeric(tool.path ?? "") + "\u200E"}
void @@ -67,7 +67,7 @@ const ContextMenu: React.FC = ({ direction: "rtl", textAlign: "left", }}> - {cleanPathPrefix(option.value || "") + "\u200E"} + {removeLeadingNonAlphanumeric(option.value || "") + "\u200E"} ) diff --git a/webview-ui/src/components/common/CodeAccordian.tsx b/webview-ui/src/components/common/CodeAccordian.tsx index cb0c02bb42..36f8fbc1f9 100644 --- a/webview-ui/src/components/common/CodeAccordian.tsx +++ b/webview-ui/src/components/common/CodeAccordian.tsx @@ -20,7 +20,7 @@ We need to remove leading non-alphanumeric characters from the path in order for [^a-zA-Z0-9]+: Matches one or more characters that are not alphanumeric. The replace method removes these matched characters, effectively trimming the string up to the first alphanumeric character. */ -export const cleanPathPrefix = (path: string): string => path.replace(/^[^\u4e00-\u9fa5a-zA-Z0-9]+/, "") +export const removeLeadingNonAlphanumeric = (path: string): string => path.replace(/^[^a-zA-Z0-9]+/, "") const CodeAccordian = ({ code, @@ -90,7 +90,7 @@ const CodeAccordian = ({ direction: "rtl", textAlign: "left", }}> - {cleanPathPrefix(path ?? "") + "\u200E"} + {removeLeadingNonAlphanumeric(path ?? "") + "\u200E"} )}