Skip to content

Commit b07707e

Browse files
authored
fix: allow deletion after selecting all text (#943)
* fix: allow deletion after selecting all text * docs: update changelog
1 parent 6b0111b commit b07707e

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

docs/content.en/docs/release-notes/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ feat: support pageup/pagedown to navigate search results #920
2020
feat: standardize multi-level menu label structure #925
2121
feat(View Extension): page field now accepts HTTP(s) links #925
2222
feat: return sub-exts when extension type exts themselves are matched #928
23-
feat: allow navigate back when cursor is at the beginning #940
2423
feat: open quick ai with modifier key + enter #939
25-
24+
feat: allow navigate back when cursor is at the beginning #940
2625

2726
### 🐛 Bug fix
2827

@@ -33,6 +32,7 @@ fix: WM ext does not work when operating focused win from another display #919
3332
fix(Window Management): Next/Previous Desktop do not work #926
3433
fix: fix page rapidly flickering issue #935
3534
fix(view extension): broken search bar UI when opening extensions via hotkey #938
35+
fix: allow deletion after selecting all text #943
3636

3737
### ✈️ Improvements
3838

src/components/Search/AssistantManager.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ export function useAssistantManager({
103103
const handleKeyDownAutoResizeTextarea = useCallback(
104104
(e: React.KeyboardEvent<HTMLTextAreaElement>) => {
105105
const { key, shiftKey, currentTarget } = e;
106-
const { value, selectionStart } = currentTarget;
106+
const { value, selectionStart, selectionEnd } = currentTarget;
107107

108-
if (key === "Backspace" && (value === "" || selectionStart === 0)) {
108+
const cursorStart = selectionStart === 0 && selectionEnd === 0;
109+
110+
if (key === "Backspace" && (value === "" || cursorStart)) {
109111
e.preventDefault();
110112

111113
return navigateBack();

0 commit comments

Comments
 (0)