Menu

#1387 Unable to scroll to caret position when using word wrap

Bug
open-accepted
SciTE (657)
2
2012-07-12
2012-07-12
No

To reproduce (Win7 Home SP2):

1) Open the attached file in SciTE or Notepad++. (There is presumably nothing special about it other than the fact that it's one really long line).
2) Make sure word wrap is on.
4) Press Ctrl+End to go to the end of the file.
5) Press Ctrl+N to open a new file.
6) Press Ctrl+Tab to go back to the attached file.

The scroll bar is at the "top", and the caret position is not visible. The caret is at the correct place, so it's just the scrolling which is off.

I was trying to fix this in Notepad++ but noticed that it happened in SciTE as well, so I think it's a problem with Scintilla.

I found this bug report but I couldn't get to work even after modifying Notepad++:
https://sourceforge.net/tracker/index.php?func=detail&aid=1207143&group_id=2439&atid=102439

Related

Bugs: #1921

Discussion

  • Andreas Jonsson

    Andreas Jonsson - 2012-07-12
     
  • Andreas Jonsson

    Andreas Jonsson - 2012-07-12

    There is no step 3 btw, that's a mistake ;)

     
  • Neil Hodgson

    Neil Hodgson - 2012-07-12

    In SciTE, the scroll position when switching tabs is set by SciTE (SciTEBase::DisplayAround), not Scintilla. I won't be working on this myself.

     
  • Neil Hodgson

    Neil Hodgson - 2012-07-12
    • assigned_to: nobody --> nyamatongwe
    • priority: 5 --> 2
    • labels: 101017 --> SciTE
    • status: open --> open-accepted
     
  • Andreas Jonsson

    Andreas Jonsson - 2012-07-13

    Yes, it's application's responsibility to set the scroll position. The thing is that it doesn't seem work. Even with a SCI_SCROLLCARET at the very of the Notepad++ equivalent of SciTEBase::DisplayAround, the result is the same: the caret position is correct (bottom of doc), but the scroll position is wrong (start of doc).

     
  • Neil Hodgson

    Neil Hodgson - 2012-07-15

    SciTE does not use SCI_SCROLLCARET when switching tabs.

    Line wrapping is a background activity that takes time. At the point that SCI_SCROLLCARET is called, it is likely that the wrapping has not yet been done.

     
  • Andreas Jonsson

    Andreas Jonsson - 2012-07-15

    Is there some way for the application to block until line wrapping has been done, so that SCI_SCROLLCARET or SCI_GOTOPOS (or similar) will take effect?

     
  • Andreas Jonsson

    Andreas Jonsson - 2012-07-15

    It's possible to get it working by sending SCI_SCROLLCARET after SCN_PAINTED.

     
  • Neil Hodgson

    Neil Hodgson - 2012-07-15

    While this will work much of the time, there are circumstances in which it may not for large files. The initial scroll position will have to be far enough down for the wrapping to have been done for the line containing the caret. To be safe, you should check that the line containing the caret is on-screen inside SCN_PAINTED.

     

Log in to post a comment.