Skip to content
This repository was archived by the owner on Feb 23, 2025. It is now read-only.

Commit

Permalink
Merge pull request #444 from liquidz/dev
Browse files Browse the repository at this point in the history
Next release
  • Loading branch information
liquidz authored Sep 12, 2022
2 parents 695382d + d961443 commit bc381c6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
@@ -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/443[#443]: Fixed evaluation spinners not to remain when codes are evaluated with `<Plug>(iced_eval)`.
// }}}

== 3.12.3148 (2022-09-10)
// {{{
Expand Down
9 changes: 5 additions & 4 deletions autoload/iced/nrepl/eval.vim
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ function! s:line_uniq_key() abort
return printf('%d-%d', bufnr('%'), line('.'))
endfunction

function! iced#nrepl#eval#out(resp, ...) abort
let opt = get(a:, 1, {})
function! iced#nrepl#eval#out(resp) abort
let opt = get(a:resp, 'iced_out_opt', {})

let spinner_key = get(opt, 'spinner_key', '')
if ! empty(spinner_key)
Expand All @@ -115,7 +115,7 @@ function! iced#nrepl#eval#out(resp, ...) abort

" Ignoring session validity means that this evaluation does not related to current buffer.
" Thus the evaluation result does not related to current cursor position.
if ! get(opt, 'ignore_session_validity', v:false)
if ! get(opt, 'ignore_session_validity', v:false)
let virtual_text_opt = copy(get(opt, 'virtual_text', {}))
let virtual_text_opt['highlight'] = g:iced#eval#popup_highlight
let virtual_text_opt['buffer'] = get(opt, 'buffer', bufnr('%'))
Expand Down Expand Up @@ -188,7 +188,7 @@ function! iced#nrepl#eval#code(code, ...) abort
let out_opt['line'] = line('.')
let out_opt['spinner_key'] = spinner_key

let Callback = get(opt, 'callback', {resp -> iced#nrepl#eval#out(resp, out_opt)})
let Callback = get(opt, 'callback', function('iced#nrepl#eval#out'))
if has_key(opt, 'callback')
unlet opt['callback']
endif
Expand All @@ -212,6 +212,7 @@ function! iced#nrepl#eval#code(code, ...) abort
\ })
endif
return iced#promise#call('iced#nrepl#eval', [code, opt])
\.then({resp -> iced#util#assoc(resp, 'iced_out_opt', out_opt)})
\.then(Callback)
finally
let @@ = reg_save
Expand Down
6 changes: 6 additions & 0 deletions autoload/iced/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ function! iced#util#partition(arr, n, is_all) abort
return result
endfunction

function! iced#util#assoc(dict, k, v) abort
let d = copy(a:dict)
let d[a:k] = a:v
return d
endfunction

function! iced#util#save_var(v, filename) abort
let serialized = string(a:v)
call writefile([serialized], a:filename)
Expand Down

0 comments on commit bc381c6

Please sign in to comment.