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

free the cursor #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chottolabs
Copy link

found a neat way to keep track of the position to stream tokens without forcing the user to keep the cursor in place

i implemented it in my own plugin (chottolabs/kznllm.nvim#9), but it might be useful here too

cursor is stuck:

dingllm_cursor_weird_.mov

cursor is free:

dingllm_cursor_fixed_.mov

@yacineMTB
Copy link
Owner

oh hell yeah thanks man

spenserlee pushed a commit to spenserlee/dingllm.nvim that referenced this pull request Aug 24, 2024
@@ -115,8 +110,7 @@ local function get_prompt(opts)
if visual_lines then
prompt = table.concat(visual_lines, '\n')
if replace then
vim.api.nvim_command 'normal! d'
vim.api.nvim_command 'normal! k'
vim.api.nvim_command 'normal! c'
Copy link

@theloner68 theloner68 Nov 19, 2024

Choose a reason for hiding this comment

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

keep starting position cursor in original start line while replacing fix the fault in VISUAL LINE mode that keep moving starting cursor to wierd place
change vim.api.nvim_command 'normal! c'
to vim.api.nvim_command 'normal! c '

Choose a reason for hiding this comment

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

20241119_103006.mp4

spenserlee added a commit to spenserlee/dingllm.nvim that referenced this pull request Dec 13, 2024
Thanks to the original work in: <yacineMTB#7>

The cursor wasn't truly free, as if you switch buffers the LLM response
stream would error out from invalid extmark changes.

Record the buffer ID and pass to data function handler for get extmark
and set_text.

This should allow for multiple requests to be running concurrently in
separate buffers.
@spenserlee
Copy link

Added a fix in my fork which fixes error if cursor changes buffer after initiating the request.

more_freedom.mp4

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.

4 participants