Fix path tab completion erasing line when cursor is on / or -#433
Merged
blink1073 merged 1 commit intoCalysto:mainfrom Apr 24, 2026
Merged
Fix path tab completion erasing line when cursor is on / or -#433blink1073 merged 1 commit intoCalysto:mainfrom
blink1073 merged 1 commit intoCalysto:mainfrom
Conversation
…ash (closes Calysto#432) - In do_complete, set cursor_start to cursor_end when obj is empty but path matches exist, so completions append at the cursor rather than replacing the entire line from position 0 - Add _request_shutdown to catch SystemExit from do_execute_direct in the base class, sending ask_exit payload and stopping the event loop for a clean exit without the "Parent appears to have exited" warning - Add regression tests for trailing-slash and trailing-dash path completion
2 tasks
blink1073
added a commit
that referenced
this pull request
Apr 28, 2026
…llow-up) (#437) When a magic's get_completions returns matches and the cursor sits after a non-identifier character such as '--', cursor_start was still left at 0, causing the client to erase and replace the entire input line. Apply the same fix used for path completions (PR #433): when info["obj"] is empty and there are matches at the end of do_complete, set cursor_start to cursor_end so completions are appended at the cursor rather than replacing from position 0. Add test_magic_complete_trailing_dash to cover this case with a custom magic that offers completions for a '--' prefix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
References
closes #432
Description
When tab-completing a path ending with
/,-, or., the identifier regex matches an empty string (these characters aren't word chars), settingcursor_startto 0. The Jupyter client then replaces the entire input line with the stripped relative completion — e.g.%ls /+ Tab producesUsersinstead of%ls /Users.Changes
metakernel/_metakernel.py: Indo_complete, setcursor_start = cursor_endwhenobjis empty but path matches exist, so completions are appended at the cursor rather than replacing from position 0.tests/test_metakernel.py: Add regression tests assertingcursor_start == cursor_endfor paths ending in/and-.Backwards-incompatible changes
None
Testing
just test tests/test_metakernel.py— all tests pass including 2 new regression testsjust typing— no issuesjust pre-commit— all hooks passAI usage