Skip to content

Build your personal knowledge base with Trilium Notes

fix(jump_to_note): caret at the end when entering command mode (closes #7942)

Elian Doran878603c7b00b
diff --git a/apps/client/src/widgets/dialogs/jump_to_note.tsx b/apps/client/src/widgets/dialogs/jump_to_note.tsx
index 89c4388039..44c825e082 100644
--- a/apps/client/src/widgets/dialogs/jump_to_note.tsx
+++ b/apps/client/src/widgets/dialogs/jump_to_note.tsx
@@ -80,9 +80,19 @@ export default function JumpToNoteDialogComponent() {
break;
}
- $autoComplete
- .trigger("focus")
- .trigger("select");
+ $autoComplete.trigger("focus");
+
+ if (mode === "commands") {
+ // In command mode, place caret at end instead of selecting all text
+ // This preserves the ">" prefix when the user starts typing
+ const input = autocompleteRef.current;
+ if (input) {
+ const len = input.value.length;
+ input.setSelectionRange(len, len);
+ }
+ } else {
+ $autoComplete.trigger("select");
+ }
// Add keyboard shortcut for full search
shortcutService.bindElShortcut($autoComplete, "ctrl+return", () => {