1

I'm trying to use balloon text for my C macros, say, true and false as follows in the terminal version.

function! MyBalloonExpr()
  let macros = {
\ 'true':"true\n1",
\ 'false':"false\n0",
\ }
  return get(macros, v:beval_text, '')
endfunction
set balloonexpr=MyBalloonExpr()
set ballooneval
set balloonevalterm

The idea is to display a two-line balloon, with the first line the macro name and the second line the macro value, e.g.

true
1

However, it gets displayed as true^@1 as if the newline were a NUL byte (^@). What am I missing? Are multi-line balloon texts possible in the terminal (they do work in the GUI version)? Is this a bug? I'm using vim 8.1.2269 compiled today.

2

I'm not sure you've seen this, but :help 'balloonexpr' says this:

To check whether line breaks in the balloon text work use this check:

 if has("balloon_multiline")

When they are supported "\n" characters will start a new line. If the expression evaluates to a |List| this is equal to using each List item as a string and putting "\n" in between them.

So if :echo has("balloon_multiline") returns 0 in your terminal, you're outta luck. If it returns 1, works in normal windows, but not in terminal windows, that looks like a bug; please report this, see :help bugs. Basically, open an issue at the bug tracker, or directly discuss this on the vim_dev mailing list.

  • :echo has("balloon_multiline") says 1, so I'm going to file the report as recommended. – Jens Nov 8 at 10:36
  • 1
    If it only affects terminal windows, it's likely an oversight; the terminal stuff was only introduced recently. – Ingo Karkat Nov 8 at 10:39
  • 2
    For those interested: github.com/vim/vim/issues/5193 – Jens Nov 8 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.