Fix autocomplete crash from stale cursor locations#16
Merged
koianaoki merged 1 commit intoMay 19, 2026
Merged
Conversation
Owner
Author
|
@codex 日本語でレビューして |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Motivation
TextArea.cursor_locationthat can contain a row beyond the current document, which previously could index past available lines.(row, col)and offset always produce values clamped to the current document bounds.Description
_location_to_offsetto clamp stale or out-of-rangerowandcolvalues to the currenttextcontent so it cannot index past available lines.offsetinside_offset_to_locationto the valid0..len(text)range before computing(row, col).tests/unit/test_autocomplete_location.pythat cover a stale row beyond the last line, an overlong column, and out-of-range offsets.Testing
pytest tests/unit/test_autocomplete_location.py -qin the environment wheretextualwas not installed and collection failed withModuleNotFoundError(expected in that environment).uv run pytest tests/unit/test_autocomplete_location.py -qwhich executed the new tests and reported3 passed.uv run ruff check sqlit/domains/query/ui/mixins/autocomplete.py tests/unit/test_autocomplete_location.pywhich completed with no linting issues.Codex Task