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

Evaluating code breaks due to long popup output #353

Closed
bootleq opened this issue Jul 18, 2021 · 2 comments
Closed

Evaluating code breaks due to long popup output #353

bootleq opened this issue Jul 18, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@bootleq
Copy link
Contributor

bootleq commented Jul 18, 2021

Currently the iced#nrepl#eval#code can break during its default callback iced#nrepl#eval#out throwing 'vim-iced: too long texts to show in popup'. Seems we have no handling for this error and lead the workflow to be halted, hooks like evaluated won't trigger, though the eval is in fact successful.

Steps to reproduce:

(Vim 8.2.3174, vim-iced 3.5.4)
Execute :IcedEval (apply str (repeat (* 54 200) "x"))
(Please change 54 200 to large enough values, to vim's &lines and &columns)

Expected result: after evaluated, small popup appear and display the result, evaluated hook (if any) can be triggered.
Actual result: no popup, no evaluated triggered (but the result does echo in vim)

Possible solution

Maybe just remove the throw code? I have done a local try and seems it works fine.

@liquidz
Copy link
Owner

liquidz commented Jul 18, 2021

@bootleq Thanks for your reporting!

Maybe just remove the throw code? I have done a local try and seems it works fine.

We are using the throw code in IcedDocumentPopupOpen and IcedSourcePopupShow as follows.

try
let s:popup_winid = popup.open(split(doc, '\r\?\n'), {
\ 'iced_context': s:popup_context({'type': 'full document'}),
\ 'group': '_document_',
\ 'line': 'near-cursor',
\ 'col': col('.'),
\ 'filetype': 'help',
\ 'border': [],
\ 'borderhighlight': ['Comment'],
\ 'auto_close': v:false,
\ 'moved': [0, &columns],
\ })
catch
call iced#message#warning('popup_error', string(v:exception))
" fallback to iced#nrepl#document#open
call s:view_doc_on_buffer(a:doc)
endtry

In this case, virtual text component which uses popup component is the problem.
And virtual text should be able to show texts of any length for Vim/Nvim, so I fixed to trim texts in virtual text component.

I just cut v3.5.5 #354
Could you try the latest version?

@liquidz liquidz added the bug Something isn't working label Jul 18, 2021
@bootleq
Copy link
Contributor Author

bootleq commented Jul 19, 2021

Thank you very much!

I didn't notice the catch in those Popup functions, just tried the new version and confirmed fixed.

@bootleq bootleq closed this as completed Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants