GitHub PullRequestReviewCommentEvent at 2014-02-24 14:19:44
Repository: pager
Actor: charypar
Payload: {"comment":{"url":"https://api.github.com/repos/redbadger/pager/pulls/comments/9992060","id":9992060,"diff_hunk":"@@ -187,21 +188,44 @@ Pager.prototype.render = function(){\n       }\n   } else {\n \n-    top_delta = Math.floor(max_pages / 2);\n-    bottom_delta = Math.floor(max_pages / 2);\n-    start_page = curr - bottom_delta;\n+    // start_page: window start position\n+    // end_page: window end position\n+    //\n+    // max_pages: pages window size to left and right from the current page\n+    // full window length is essentially max_pages * 2 + 1\n+    //\n+    // start_delta: extra pages to extend the end of window when current page is\n+    // too close to 0\n+    //\n+    // end_delta: extra pages to extend the start of window when current page is\n+    // too close to an end\n+    //\n+    // Rendering ... spaces only when difference between start window and 1 as well\n+    // as end window and pages count is greater than 1\n+\n+    start_page = curr - max_pages;\n+    start_delta = 0;\n+    end_delta = 0;\n \n     if(start_page < 0) {\n       start_page = 0;\n+      start_delta = Math.abs(curr - max_pages)\n     } else {","path":"index.js","position":41,"original_position":41,"commit_id":"eb7ce0eaac950d06b263c9d7bedf20fa624193e6","original_commit_id":"eb7ce0eaac950d06b263c9d7bedf20fa624193e6","user":{"login":"charypar","id":1517854,"avatar_url":"https://gravatar.com/avatar/0f5f26703bab51dc7748c53baafd8769?d=https%3A%2F%2Fidenticons.github.com%2F1f9945a5472d0276459a9ed61c393e49.png&r=x","gravatar_id":"0f5f26703bab51dc7748c53baafd8769","url":"https://api.github.com/users/charypar","html_url":"https://github.com/charypar","followers_url":"https://api.github.com/users/charypar/followers","following_url":"https://api.github.com/users/charypar/following{/other_user}","gists_url":"https://api.github.com/users/charypar/gists{/gist_id}","starred_url":"https://api.github.com/users/charypar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charypar/subscriptions","organizations_url":"https://api.github.com/users/charypar/orgs","repos_url":"https://api.github.com/users/charypar/repos","events_url":"https://api.github.com/users/charypar/events{/privacy}","received_events_url":"https://api.github.com/users/charypar/received_events","type":"User","site_admin":false},"body":"`} else if {`?","created_at":"2014-02-24T14:19:44Z","updated_at":"2014-02-24T14:19:44Z","html_url":"https://github.com/redbadger/pager/pull/2#discussion_r9992060","pull_request_url":"https://api.github.com/repos/redbadger/pager/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/redbadger/pager/pulls/comments/9992060"},"html":{"href":"https://github.com/redbadger/pager/pull/2#discussion_r9992060"},"pull_request":{"href":"https://api.github.com/repos/redbadger/pager/pulls/2"}}}}