|
1 | 1 | scriptencoding utf-8 |
2 | 2 |
|
| 3 | +let thinkingWindow |
3 | 4 | let s:has_nvim_ghost_text = has('nvim-0.7') && exists('*nvim_buf_get_mark') |
4 | 5 | let s:vim_minimum_version = '9.0.0185' |
5 | 6 | let s:has_vim_ghost_text = has('patch-' . s:vim_minimum_version) && has('textprop') |
@@ -320,6 +321,7 @@ function! s:UpdatePreview() abort |
320 | 321 | endif |
321 | 322 | if empty(text) || !s:has_ghost_text |
322 | 323 | "call s:Echo('Done')" |
| 324 | + vim.api.nvim_win_close(thinkingWindow, true) |
323 | 325 | return s:ClearPreview() |
324 | 326 | endif |
325 | 327 | if exists('b:_copilot.cycling_callbacks') |
@@ -423,6 +425,30 @@ function! copilot#Schedule() abort |
423 | 425 | return |
424 | 426 | endif |
425 | 427 | "call s:Echo('Copilot Thinking ' . "\uF1E6")" |
| 428 | + |
| 429 | + local buf = vim.api.nvim_create_buf(false, true) |
| 430 | + |
| 431 | + -- Set the buffer content to the desired icon or text |
| 432 | + vim.api.nvim_buf_set_lines(buf, 0, -1, false, { " 🔍" }) |
| 433 | + |
| 434 | + -- Get the current editor dimensions |
| 435 | + local width = vim.api.nvim_get_option("columns") |
| 436 | + local height = vim.api.nvim_get_option("lines") |
| 437 | + |
| 438 | + -- Calculate the position for the top right corner |
| 439 | + local win_opts = { |
| 440 | + relative = "editor", |
| 441 | + width = 3, |
| 442 | + height = 1, |
| 443 | + col = 0, |
| 444 | + row = height - 2, |
| 445 | + style = "minimal", |
| 446 | + border = "none", |
| 447 | + } |
| 448 | + |
| 449 | + thinkingWindow = vim.api.nvim_open_win(buf, false, win_opts) |
| 450 | + |
| 451 | + |
426 | 452 | call s:UpdatePreview() |
427 | 453 | let delay = get(g:, 'copilot_idle_delay', 45) |
428 | 454 | call timer_stop(get(g:, '_copilot_timer', -1)) |
|
0 commit comments