Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typeahead backspace cleanup #293

Merged
merged 4 commits into from
Dec 9, 2024
Merged

Conversation

dingfeli
Copy link
Contributor

@dingfeli dingfeli commented Dec 5, 2024

Issue #, if available:
#296 (comment)

Context:

  • When an inline session is invoked in the middle of a line and whose suggestion returned as multiple lines (i.e. the suggestion contains line break), the right context on the invocation line is always discarded by the lsp server.
  • This intent to discard said right context under the aforementioned condition is denoted visually by a strike through.
  • During the preview, said right context is deleted from the user buffer in the editor, but stored in memory.
  • Should user decides to accept the suggestion, said right context would be deleted permanently.
  • If preview is terminated without acceptance, said right context would once again be appended.

Description of changes:

  • Simplifies the logic to capture right context on the same line when starting a typeahead session
  • Accordingly simplifies the logic to "return" the right context when said session ends
  • Calls redraw on widget in a display thread after having checked for dispose status for safety

Test:
On mac:

  • Deleting past inline invocation offset does not cause the subsequent lines to be edited
    macos_deletion

On windows:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@dingfeli dingfeli marked this pull request as ready for review December 5, 2024 19:03
@breedloj breedloj merged commit fffb6fc into main Dec 9, 2024
1 check passed
@breedloj breedloj deleted the fix-typeahead-backspace-cleanup branch December 9, 2024 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants