New function to get screenpos of a text character only when it is visible
See comment below.
Have updated the issue text (because it previously has false statements). Duplicate it here because maillist wan't updated.
There are situation in my vimfu when i really want to know if some position of a window or better character of a buffer is trully visible (not blocking by anything, sign/linenr columns, popup windows). Lets say you want to add popup window to this location or text property only when it is visible etc.
Present screenpos() function has it's limitations: it returns position of the character even if it is blocked by signcolumn when wrap is off and buffer text is shifted to the right, it returns position even when character is blocked by popup windows. Also when wrap is on and last line is wrapped it returns positions of character under @@@ not trully visible line. Also blocked by extends and precedes chars of listchars option of not wrapped lines but which do not fit into the screen.
All this problems are solvable. You can get all required position for popup windows. You can find if listchars has precedes and extends chars and when line doesn't fit to the screen. It is possible to deal with last wrapped invisible chars too. It is harder to get the size of sign/linnr column because there is no dedicated function too, so it requires some hacky implementations. So dealing with all this exceptions is somewhat cumbersome.
Would you find presence of such a function worth the effort to implement?
I suppose it can be useful, but it might be quite a bit of work to get it right.
It is harder to get the size of sign/linnr column because there is no dedicated function too, so it requires some hacky implementations.
It doesn't invalidate the feature request, but you might still be interested in the textoff property of a window:
:echo win_getid()->getwininfo()[0].textoff
See :help getwininfo():
textoff number of columns occupied by any 'foldcolumn', 'signcolumn' and line number in front of the text
It doesn't invalidate the feature request, but you might still be interested in the
textoffproperty of a window
Thank you so much once again @lacygoill
How have i overlooked it even if i do use getwininfo() quite often :( Did getwininfo() dict have textoff from time it was added to vim? Or added afterwards?
It was added in patch 8.2.3627
@zeertzjq Thanks.