Consider the following snippet:
vim9script var winid = win_getid() var winwidth = winwidth(winid) var range =  for lnum in range(10, 20) add(range, [lnum, 0, winwidth(winid)]) endfor var m = matchaddpos("CursorWord0", range)
:h matchaddpos() the second argument can be
... - A list with two numbers, e.g., [23, 11]. The first number is the line number, the second one is the column number (first column is 1, the value must correspond to the byte index as |col()| would return). The character at this position will be highlighted. - A list with three numbers, e.g., [23, 11, 3]. As above, but the third number gives the length of the highlight in bytes.
In-spite I use
winwidth(winid) as third element of each three-dimensional list, I get highlighted only the text.
What I mean is that, for example, if I have a line that contains 3 characters:
and my window width is 150, then I get highlighted only the first 3 columns whereas I want to highlight ALL the 150 columns.
On the same topic: how to define a pattern that ends where the window end?
For example, if I want to highlight a line from
"\^XXX" to the end of the current windows, I am thinking to define a pattern as
"\^XXX* but I have no idea on how to end it to specify the end of the current window.