fix: check if window is valid before calling get_cursor#1359
Merged
deathbeam merged 1 commit intoCopilotC-Nvim:mainfrom Aug 25, 2025
Merged
fix: check if window is valid before calling get_cursor#1359deathbeam merged 1 commit intoCopilotC-Nvim:mainfrom
deathbeam merged 1 commit intoCopilotC-Nvim:mainfrom
Conversation
bdd830d to
a04cae2
Compare
Collaborator
|
Hmm this just hides all errors from the callback completely which is not rly proper fix (as the callback is basically everything after .schedule_main). It looks like issue is completion so maybe just some additional validation there is needed? |
Collaborator
|
Basically the proper fix is check if local row_changed = vim.api.nvim_win_get_cursor(win)[1] ~= row the win is valid first |
Contributor
Author
Ah of course! updated and tested. |
7657e2c to
10a6ca0
Compare
Signed-off-by: sami <sami@appscode.com>
10a6ca0 to
1695bdd
Compare
Collaborator
|
Thanks! @all-contributors add @samiulsami for code |
Contributor
|
I've put up a pull request to add @samiulsami! 🎉 |
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.
Fixes issue when toggling on/off the floating chat window quickly, which sometimes causes the program to attempt a scheduled write on an invalid window:
my config for reference:
{ model = "gpt-5-mini", temperature = 0.1, window = { layout = "float", width = 1, height = 1, row = 9999999, blend = 10, }, auto_insert_mode = true, mappings = { close = { normal = "<Esc>", insert = "<C-c>", callback = function() chat.save(vim.fn.sha256(vim.fn.getcwd())) chat.close() end, }, }, }) vim.keymap.set({ "n", "v", "i" }, "<A-C>", function() chat.toggle() end, { noremap = true, silent = true, desc = "Copilot Chat: Toggle" })