WebKit, previews, and scrolling

Wolf Rentzsch complains that BBEdit 7.1’s new Preview in BBEdit feature resets the scroll position every time the text it’s previewing changes. I’ve complained a couple of times that NetNewsWire’s weblog editor’s Preview window does the same thing. I wonder if it’s just a coincidence that both applications have the same problem or if maintaining the scroll position is simply very difficult or impossible with WebKit.

2 Comments

  1. Dominik Wagner Said,

    November 18, 2003 @ 10:35 pm

    Have a look at SubEthaEdit. Here we faced the same problem and came up with a simple solution.

    In fact it’s very easy with the WebKit. When you reload:
    - Search for the correct ScrollView in the WebView
    - remember its documentVisibleRect
    - reload webview

    on callback of the didFinishLoad:
    - go to the correct ScrollView
    - scrollRectToVisible

    Voilá. We never would have thought of shipping SubEthaEdit with the WebPreview without this, because it’s quite unusable if you really want to work with it. It’s a shame BBEdit does not get it right, but well, this on of the reasons why we did SubEthaEdit in the first place.

  2. Brent Simmons Said,

    November 19, 2003 @ 10:53 am

    Great tip! I needed that.

RSS feed for comments on this post