fix: tag autocomplete leaves the cursor at the end of the query #22

Merged
clanker merged 1 commit from pr/fix-completion-cursor into master 2026-08-14 21:01:08 +00:00
Member

Fix: cursor placement after tag autocomplete.

handleCompletion rebuilds the query via setPlainText, which resets the cursor to position 0 — so after picking a tag from the completer popup (in / or t t), the caret jumped to the start of the box. Now it's placed at the end (after the trailing space), so typing continues naturally: tag:inbox and ….

Same pattern already used for history recall. Regression test added (test_completion_leaves_cursor_at_end): completing tag:in → tag:inbox with the cursor at the end. Suite: 126 passed, mypy 0.

**Fix: cursor placement after tag autocomplete.** `handleCompletion` rebuilds the query via `setPlainText`, which resets the cursor to position 0 — so after picking a tag from the completer popup (in `/` or `t t`), the caret jumped to the start of the box. Now it's placed at the end (after the trailing space), so typing continues naturally: `tag:inbox and …`. Same pattern already used for history recall. Regression test added (`test_completion_leaves_cursor_at_end`): completing `tag:in` → `tag:inbox ` with the cursor at the end. Suite: **126 passed**, mypy **0**.
handleCompletion() rebuilds the text via setPlainText, which resets the
cursor to position 0 — so after picking a tag from the completer popup
the caret jumped to the start. Call _cursor_to_end() so the user can
keep typing the next term (e.g. 'tag:inbox and …'). Same fix pattern
as history recall.

Test: completion produces 'tag:inbox ' with the cursor at the end.
Suite: 126 passed, mypy 0.
clanker merged commit 0845cd6ac4 into master 2026-08-14 21:01:08 +00:00
clanker deleted branch pr/fix-completion-cursor 2026-08-14 21:01:09 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Home/lazarus!22
No description provided.