From 95dc7a88d24e98afb4722ad6621220442d33bd04 Mon Sep 17 00:00:00 2001 From: BiggerRain <15911122312@163.COM> Date: Sat, 11 Oct 2025 15:38:15 +0800 Subject: [PATCH] feat: support moving cursor with home and end keys (#918) * feat: support moving cursor with home and end keys * docs: add release notes --- docs/content.en/docs/release-notes/_index.md | 1 + src/components/Search/AssistantManager.tsx | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/content.en/docs/release-notes/_index.md b/docs/content.en/docs/release-notes/_index.md index b1d6a170..4fb9f731 100644 --- a/docs/content.en/docs/release-notes/_index.md +++ b/docs/content.en/docs/release-notes/_index.md @@ -15,6 +15,7 @@ Information about release notes of Coco App is provided here. feat: support switching groups via keyboard shortcuts #911 feat: support opening logs from about page #915 +feat: support moving cursor with home and end keys #918 ### 🐛 Bug fix diff --git a/src/components/Search/AssistantManager.tsx b/src/components/Search/AssistantManager.tsx index bf7dcec1..bbd2949b 100644 --- a/src/components/Search/AssistantManager.tsx +++ b/src/components/Search/AssistantManager.tsx @@ -147,6 +147,17 @@ export function useAssistantManager({ handleSubmit(); } + + if (key === "Home") { + e.preventDefault(); + return currentTarget.setSelectionRange(0, 0); + } + + if (key === "End") { + e.preventDefault(); + const length = currentTarget.value.length; + return currentTarget.setSelectionRange(length, length); + } }, [ isChatMode,