From c52ec163b83dc63eb9fff41595635d4d15909d86 Mon Sep 17 00:00:00 2001 From: liquidz Date: Sat, 24 Jun 2023 12:45:10 +0900 Subject: [PATCH 1/5] chore: Tweak neovim popup options --- autoload/iced/component/popup/neovim.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autoload/iced/component/popup/neovim.vim b/autoload/iced/component/popup/neovim.vim index 04176c53..d651f825 100644 --- a/autoload/iced/component/popup/neovim.vim +++ b/autoload/iced/component/popup/neovim.vim @@ -185,6 +185,8 @@ function! s:popup.open(texts, ...) abort \ 'width': width, \ 'height': height, \ 'style': g:iced#popup#neovim#style, + \ 'focusable': v:false, + \ 'noautocmd': v:false, \ } if has_key(opts, 'border') && has('nvim-0.5') From 6c1922f988b790ac1fa841d9c6db5ea6c0e1da21 Mon Sep 17 00:00:00 2001 From: liquidz Date: Sat, 24 Jun 2023 15:51:39 +0900 Subject: [PATCH 2/5] feat: Update temporary buffer to be able to set buftype --- autoload/iced/buffer/temporary.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/iced/buffer/temporary.vim b/autoload/iced/buffer/temporary.vim index 8dfad7bb..c038fd74 100644 --- a/autoload/iced/buffer/temporary.vim +++ b/autoload/iced/buffer/temporary.vim @@ -15,7 +15,12 @@ function! iced#buffer#temporary#init() abort return iced#buffer#init(s:bufname, funcref('s:initialize')) endfunction -function! iced#buffer#temporary#begin() abort +function! iced#buffer#temporary#begin(...) abort + let opts = get(a:, 1, {}) + let buftype = get(opts, 'buftype', 'nofile') + let nr = iced#buffer#nr(s:bufname) + call setbufvar(nr, '&buftype', buftype) + let s:current_window = winnr() call iced#buffer#open(s:bufname, {'opener': 'split'}) call iced#buffer#clear(s:bufname) From 71a1c3905dc551a558f7a9aa89d42063d8f9de8b Mon Sep 17 00:00:00 2001 From: liquidz Date: Sat, 24 Jun 2023 15:52:20 +0900 Subject: [PATCH 3/5] fix: Fix extracting source function to use nowrite buftype for zipfile --- autoload/iced/nrepl/source.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autoload/iced/nrepl/source.vim b/autoload/iced/nrepl/source.vim index 77c87ebf..ae4ae1e8 100644 --- a/autoload/iced/nrepl/source.vim +++ b/autoload/iced/nrepl/source.vim @@ -12,7 +12,11 @@ function! s:__extract_source(resp) abort let code = '' let reg_save = @@ try - call iced#buffer#temporary#begin() + if stridx(path, 'zipfile') == 0 + call iced#buffer#temporary#begin({'buftype': 'nowrite'}) + else + call iced#buffer#temporary#begin({'buftype': 'nofile'}) + endif call iced#system#get('ex_cmd').silent_exe(printf(':read %s', path)) call cursor(a:resp['line']+1, get(a:resp, 'column', 0)) silent normal! vaby From f6ce56bf76265786c28cca2a09198e8785aaeabd Mon Sep 17 00:00:00 2001 From: liquidz Date: Sat, 24 Jun 2023 15:52:54 +0900 Subject: [PATCH 4/5] fix: Fix neovim popup component not to close immediately --- autoload/iced/component/popup/neovim.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autoload/iced/component/popup/neovim.vim b/autoload/iced/component/popup/neovim.vim index d651f825..690c8b6a 100644 --- a/autoload/iced/component/popup/neovim.vim +++ b/autoload/iced/component/popup/neovim.vim @@ -19,6 +19,7 @@ function! s:init_win(winid, opts) abort let context['__lnum'] = line('.') if has_key(a:opts, 'moved') let context['__moved'] = a:opts['moved'] + let context['__reltime'] = reltime() endif call setwinvar(a:winid, 'iced_context', context) @@ -265,13 +266,14 @@ function! iced#component#popup#neovim#moved() abort let base_line = get(context, '__lnum', 0) let line = line('.') let col = col('.') + let elapsed = reltimefloat(reltime(get(context, '__reltime', reltime()))) " WARN: only supports 'any' and column list if empty(moved) return - elseif type(moved) == v:t_string && moved ==# 'any' + elseif type(moved) == v:t_string && moved ==# 'any' && elapsed > 0.1 return s:popup.close(s:last_winid) - elseif type(moved) == v:t_list && (line != base_line || col < moved[0] || col > moved[1]) + elseif type(moved) == v:t_list && (line != base_line || col < moved[0] || col > moved[1]) && elapsed > 0.1 return s:popup.close(s:last_winid) endif endfunction From ca48dd8ebe40551570cb7c9a9f0aac797925aaf8 Mon Sep 17 00:00:00 2001 From: liquidz Date: Sun, 25 Jun 2023 04:03:20 +0900 Subject: [PATCH 5/5] docs: Update CHANGELOG --- CHANGELOG.adoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 68710a46..af70e3fb 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -1,6 +1,10 @@ All notable changes to this project will be documented in this file. This change log follows the conventions of http://keepachangelog.com/[keepachangelog.com]. == Unreleased (dev) +// {{{ +=== Fixed +* https://github.com/liquidz/vim-iced/issues/461[#461]: Fixed `IcedSourceShow` and `IcedSourcePopupShow` to work correctly on Neovim. +// }}} == 3.14.3233 (2023-06-24) // {{{