Skip to content

Conversation

@ultronozm
Copy link
Contributor

This PR adds some boundary checks, fixing sporadic issues that I
encountered, and also adds a call to "widen" to fix the following
easily reproduced issue: copilot-mode does not work correctly when
activated in an already narrowed buffer.

  • copilot.el (copilot--get-source): Widen at beginning. Add buffer
    boundary checks when truncating the buffer content. Ensure that
    substring operations never exceed buffer limits by clamping to valid
    ranges.

* copilot.el (copilot--get-source): Widen at beginning.  Add buffer
boundary checks when truncating the buffer content.  Ensure that
substring operations never exceed buffer limits by clamping to valid
ranges.
Copy link
Collaborator

@bbatsov bbatsov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks!

@bbatsov bbatsov merged commit acea148 into copilot-emacs:main Jun 22, 2025
13 checks passed
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