How to make visible selection of a fragment on a long wrapped line that is below the screen?

26 views
Skip to first unread message

Paul K

unread,
May 13, 2016, 1:28:22 AM5/13/16
to scintilla-interest
Neil:

I have a long wrapped line and a selection on that line that is below the screen (as the line wraps for more lines than LinesOnScreen). I'm using ENSUREVISIBLEENFORCEPOLICY, but it only works at the line level. If the lines are not wrapped, I'm using SetXOffset.

What is the correct way to move that selection into view when the lines are wrapped? Thank you.

Paul.

Neil Hodgson

unread,
May 13, 2016, 8:10:46 AM5/13/16
to scintilla...@googlegroups.com
Paul K:

> I have a long wrapped line and a selection on that line that is below the screen (as the line wraps for more lines than LinesOnScreen). I'm using ENSUREVISIBLEENFORCEPOLICY, but it only works at the line level. If the lines are not wrapped, I'm using SetXOffset.
>
> What is the correct way to move that selection into view when the lines are wrapped? Thank you.

You could try SCI_SCROLLRANGE.

Neil

Paul K

unread,
May 13, 2016, 12:20:46 PM5/13/16
to scintilla-interest, nyama...@me.com
Neil:

> You could try SCI_SCROLLRANGE. 

I considered this, but how do I know the number of lines I need to scroll to? Essentially the question is, when the line is wrapped and I know the position in the line, how do I map this to the actual line it's on because of wrapping?

Paul.

Neil Hodgson

unread,
May 13, 2016, 7:44:23 PM5/13/16
to scintilla...@googlegroups.com
Paul K:

> > You could try SCI_SCROLLRANGE.
>
> I considered this, but how do I know the number of lines I need to scroll to? Essentially the question is, when the line is wrapped and I know the position in the line, how do I map this to the actual line it's on because of wrapping?

SCI_SCROLLRANGE is positions, not lines.

Neil

Paul K

unread,
May 14, 2016, 1:35:55 AM5/14/16
to scintilla-interest, nyama...@me.com
Neil:

> SCI_SCROLLRANGE is positions, not lines.

This works; thank you. I confused it with another method.

Paul.
Reply all
Reply to author
Forward
0 new messages