Save viewport position if loading in background.
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 12 Oct 2009 16:59:24 +0000 (10:59 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 12 Oct 2009 17:01:00 +0000 (11:01 -0600)
This would manifest itself when background loading the INBOX on login.
If the first viewable message was not in the base slice, the viewport
would not be positioned correctly when eventually viewed.

imp/js/ViewPort.js

index c48a941..762db06 100644 (file)
@@ -702,6 +702,11 @@ var ViewPort = Class.create({
         // TODO: Flag for no _fetchBuffer()?
         if (this.view == r.view) {
             this._updateContent(Object.isUndefined(offset) ? (r.rownum ? Number(r.rownum) - 1 : this.currentOffset()) : offset);
+        } else if (r.rownum) {
+            // We loaded in the background. If rownumber information was
+            // provided, we need to save this or else we will position the
+            // viewport incorrectly.
+            buffer.setMetaData({ offset: Number(r.rownum) - 1 }, true);
         }
 
         this.isbusy = false;