On 21 October 2014, Christian Brabandt <[email protected]> wrote:
> Am 2014-10-20 23:29, schrieb LCD 47:
> >On 20 October 2014, Christian Brabandt <[email protected]> wrote:
> >>On Fr, 17 Okt 2014, LCD 47 wrote:
> >>> Namely, compare the effect of:
> >>>
> >>> set beval bexpr=['foo']
> >>>
> >>> to the effect of:
> >>>
> >>> set beval bexpr='foo'
> >>>
> >>> This happens because general_beval_cb() in gui_beval.c calls
> >>> eval_to_string() to evaluate 'balloonexpr', and that function adds the
> >>> trailing "\n". I don't see any non-intrusive fix to this.
> >>
> >>I only have a "relative old" version of 7.4 for Windows to check, but
> >>there I didn't see a difference between
> >>:set beval bexpr=['foo']
> >>and
> >>:set beval bexpr='foo'
> >>
> >>Perhaps someone else with a more recent version can verify?
> >
> > eval_to_string() has changed in 7.3.272 to add a trailing newline,
>
> Yes, I remember there was a patch that changed that. But wasn't sure,
> this was after 7.4 or earlier.
>
> >all other relevant pieces are essentially unchanged. If you don't
> >see any difference it might be because whatever it is on your Windows
> >that is used to display tooltips doesn't support multiline balloons.
> >The problem is definitely reproducible on UNIX; I'd post a snapshot,
> >but I'm not sure how to take one that includes the balloons.
>
> It does (also has("balloon_multiline") evals to 1).
> At least setting balloonexpr=['foo', 'bar'] works. While neither this:
> :set balloonexpr='foo\n' (displays (foon)
> nor this:
> :set balloonexpr="foo\n" (doesn't show up at all)
This is evaluated as a "set" command, and the result has to be a
constant expression. Try this:
:set beval bexpr=\"foo\\n\"
Or just create a function that returns "foo\n". Anyway, it looks
like Windows strips the trailing newline regardless of how it got
there, which means Bram's suggestion of stripping it in Vim won't break
anything.
> I also just saw my Vim 7.4 just crash when trying something like set
> ballonexpr="foo\nbar"
> but can't seem to reproduce this.
If that happens, it's unrelated...
> BTW: can't we just check, if balloonexpr is a list with a non-empty
> last element and if so, strip the final '\n'?
It's an expression: we have to evaluate it to find out it
resolves to a list, and at that point we'd be duplicating most of
eval_to_string().
/lcd
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.