[vim/vim] Virtual text with newlines renders incorrectly (Issue #10842)

35 views
Skip to first unread message

Ben Jackson

unread,
Aug 3, 2022, 4:55:20 PM8/3/22
to vim/vim, Subscribed

Steps to reproduce

test_prop_text.vim:

" This line
" This should not be overwritten
set signcolumn=yes
silent! call prop_type_delete( "a_test" )
call prop_type_add( "a_test", #{ highlight: 'Error' } )
py3 vim.vars[ 'prop_id' ] = vim.eval( 'prop_add( 1, 12, #{ text: "Some text\nnewline", type: "a_test" } )' )

function! Clear()
  call prop_remove( #{ id: g:prop_id } )
endfunction
  • vim --clean -S test_prop_text.vim test_prop_text.vim
  • see the text prop renders the virtual text including the newline (unexpected?)
  • move the cursor up/down - redraws over the virtual text
  • ctrl-l does't clear it
  • :call Clear() - this resolves it.

Screenshot 2022-08-03 at 21 49 47

I think the solution here is to just not allow newlines in virtual text (for now?) as this seems super hard to get right. Alternatively we could just replace them with a space or something like we do for tab characters.

Expected behaviour

Either replace the newlines with something like a space, or raise an error.

Version of Vim

9.0.137

Environment

macOS

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10842@github.com>

Bram Moolenaar

unread,
Aug 4, 2022, 8:25:08 AM8/4/22
to vim/vim, Subscribed

I think we need to disallow special characters like Tab and Newline in the text, otherwise it gets too complicated to compute what is displayed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10842/1205184678@github.com>

Ben Jackson

unread,
Aug 4, 2022, 8:30:03 AM8/4/22
to vim/vim, Subscribed

Yeah I agree.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10842/1205189990@github.com>

Bram Moolenaar

unread,
Aug 4, 2022, 10:04:35 AM8/4/22
to vim/vim, Subscribed

Closed #10842 as completed via 398649e.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/10842/issue_event/7128160933@github.com>

Reply all
Reply to author
Forward
0 new messages