Skip to content

Cursor position incorrect when wrapped virtual text property removed in CursorMoved #10898

@puremourning

Description

@puremourning

Steps to reproduce

call prop_type_add( 'prop', #{ highlight: 'Error' } )
let g:multi_line_text = repeat( 'x', &columns * 4 )

let g:prop_id = v:null
function! Update()
  if line( '.' ) == 1
    let g:prop_id = prop_add( 1, 0, #{ type: 'prop', text_algin: 'right', text_wrap: 'wrap', text: g:multi_line_text } )
  elseif g:prop_id != v:null
    call prop_remove( #{ id: g:prop_id } )
    let g:prop_id = v:null
  endif
endfunction

autocmd CursorMoved * call Update()
  • vim --clean -S test.vim test.vim
  • (check the cursor is on line 1, else go to line 1) - see the virtual text is wrapped across multiple lines
  • j - move the cursor down 1 line

Actual behaviour is the cursor is drawn on line 6 (though reports line 2)

Expected behaviour

Cursor is drawn on line 2.

Version of Vim

9.0.193

Environment

macOS arm64

Logs and stack traces

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions