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) // {{{ 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) diff --git a/autoload/iced/component/popup/neovim.vim b/autoload/iced/component/popup/neovim.vim index 04176c53..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) @@ -185,6 +186,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') @@ -263,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 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