GitHub PullRequestReviewCommentEvent at 2014-06-09 22:17:39
Repository: brackets
Actor: albertxing
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/adobe/brackets/pulls/comments/13568240","id":13568240,"diff_hunk":"@@ -1030,6 +1030,31 @@ define(function (require, exports, module) {\n             this.setScrollPos(null, pos);\n         }\n     };\n+    \n+    /**\n+     * Determines if the cursor is currently visible and if not, and if not\n+     * scrolls the editor view port maintaining the distance between the cursor\n+     * and the bottom, to a maximum where the cursor is centered vertically\n+     * within the editor.\n+     */\n+    Editor.prototype.pushUpCursor = function () {\n+        var $scrollerElement = $(this.getScrollerElement()),\n+            editorHeight = $scrollerElement.height(),\n+            statusBarHeight = $(\"#status-bar\").outerHeight(),\n+            menuBarHeight = $scrollerElement.offset().top,\n+            bottom = window.innerHeight - menuBarHeight - statusBarHeight - editorHeight,\n+            cursorPosition = this._codeMirror.cursorCoords(null, \"page\").bottom;\n+        \n+        if (cursorPosition > $scrollerElement.outerHeight() + 4) {","path":"src/editor/Editor.js","position":19,"original_position":19,"commit_id":"9da42e7e97567dd21f000527b99387f9dd4982e1","original_commit_id":"9da42e7e97567dd21f000527b99387f9dd4982e1","user":{"login":"albertxing","id":2881206,"avatar_url":"https://avatars.githubusercontent.com/u/2881206?","gravatar_id":"7e5976a9d93cdaf6183e6e445c460b73","url":"https://api.github.com/users/albertxing","html_url":"https://github.com/albertxing","followers_url":"https://api.github.com/users/albertxing/followers","following_url":"https://api.github.com/users/albertxing/following{/other_user}","gists_url":"https://api.github.com/users/albertxing/gists{/gist_id}","starred_url":"https://api.github.com/users/albertxing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/albertxing/subscriptions","organizations_url":"https://api.github.com/users/albertxing/orgs","repos_url":"https://api.github.com/users/albertxing/repos","events_url":"https://api.github.com/users/albertxing/events{/privacy}","received_events_url":"https://api.github.com/users/albertxing/received_events","type":"User","site_admin":false},"body":"Not sure, that's why it's magic :wink:\r\nThere are many \"methods\" of getting the distance between the bottom of the cursor and the bottom of the editor.\r\n\r\n 1. `$scrollerElement.outerHeight() - cursorCoords(null, \"page\").bottom` gives a 4px inconsistency (i.e. when the cursor is exactly touching the bottom, say by using the arrow keys and pressing down until the document starts scrolling, the distance is 4px)\r\n\r\n 2. `$scrollerElement.height() - menuBarHeight - cursorCoords.bottom` gives a 3px inconsistency\r\n\r\n 3. `cursorCoords(null, \"local\").bottom - this.getScrollPos().y` gives a 3px inconistency.\r\n\r\nI thought it might have been the \"space\" between the cursor and the next line, but if you take the difference between the positions for the top and bottom edges of the cursor you get 15px, which is the text height specified by `this.getTextHeight()`. Any thoughts?","created_at":"2014-06-09T22:17:39Z","updated_at":"2014-06-09T22:17:39Z","html_url":"https://github.com/adobe/brackets/pull/7875#discussion_r13568240","pull_request_url":"https://api.github.com/repos/adobe/brackets/pulls/7875","_links":{"self":{"href":"https://api.github.com/repos/adobe/brackets/pulls/comments/13568240"},"html":{"href":"https://github.com/adobe/brackets/pull/7875#discussion_r13568240"},"pull_request":{"href":"https://api.github.com/repos/adobe/brackets/pulls/7875"}}},"pull_request":{"url":"https://api.github.com/repos/adobe/brackets/pulls/7875","id":16023000,"html_url":"https://github.com/adobe/brackets/pull/7875","diff_url":"https://github.com/adobe/brackets/pull/7875.diff","patch_url":"https://github.com/adobe/brackets/pull/7875.patch","issue_url":"https://api.github.com/repos/adobe/brackets/issues/7875","number":7875,"state":"open","title":"Reveal cursor on panel expand","user":{"login":"albertxing","id":2881206,"avatar_url":"https://avatars.githubusercontent.com/u/2881206?","gravatar_id":"7e5976a9d93cdaf6183e6e445c460b73","url":"https://api.github.com/users/albertxing","html_url":"https://github.com/albertxing","followers_url":"https://api.github.com/users/albertxing/followers","following_url":"https://api.github.com/users/albertxing/following{/other_user}","gists_url":"https://api.github.com/users/albertxing/gists{/gist_id}","starred_url":"https://api.github.com/users/albertxing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/albertxing/subscriptions","organizations_url":"https://api.github.com/users/albertxing/orgs","repos_url":"https://api.github.com/users/albertxing/repos","events_url":"https://api.github.com/users/albertxing/events{/privacy}","received_events_url":"https://api.github.com/users/albertxing/received_events","type":"User","site_admin":false},"body":"@peterflynn Simple fix for issue #3003, and (nearly) identical to closed and outdated pull request #3931.","created_at":"2014-05-17T19:09:26Z","updated_at":"2014-06-09T22:17:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"29ca4a77839fe0288ddacae1b6c755acdcd14b69","assignee":{"login":"peterflynn","id":1197510,"avatar_url":"https://avatars.githubusercontent.com/u/1197510?","gravatar_id":"f8b97ac818aaa02413fe4f96325acdfd","url":"https://api.github.com/users/peterflynn","html_url":"https://github.com/peterflynn","followers_url":"https://api.github.com/users/peterflynn/followers","following_url":"https://api.github.com/users/peterflynn/following{/other_user}","gists_url":"https://api.github.com/users/peterflynn/gists{/gist_id}","starred_url":"https://api.github.com/users/peterflynn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterflynn/subscriptions","organizations_url":"https://api.github.com/users/peterflynn/orgs","repos_url":"https://api.github.com/users/peterflynn/repos","events_url":"https://api.github.com/users/peterflynn/events{/privacy}","received_events_url":"https://api.github.com/users/peterflynn/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/adobe/brackets/pulls/7875/commits","review_comments_url":"https://api.github.com/repos/adobe/brackets/pulls/7875/comments","review_comment_url":"https://api.github.com/repos/adobe/brackets/pulls/comments/{number}","comments_url":"https://api.github.com/repos/adobe/brackets/issues/7875/comments","statuses_url":"https://api.github.com/repos/adobe/brackets/statuses/9da42e7e97567dd21f000527b99387f9dd4982e1","head":{"label":"albertxing:albertxing/3003","ref":"albertxing/3003","sha":"9da42e7e97567dd21f000527b99387f9dd4982e1","user":{"login":"albertxing","id":2881206,"avatar_url":"https://avatars.githubusercontent.com/u/2881206?","gravatar_id":"7e5976a9d93cdaf6183e6e445c460b73","url":"https://api.github.com/users/albertxing","html_url":"https://github.com/albertxing","followers_url":"https://api.github.com/users/albertxing/followers","following_url":"https://api.github.com/users/albertxing/following{/other_user}","gists_url":"https://api.github.com/users/albertxing/gists{/gist_id}","starred_url":"https://api.github.com/users/albertxing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/albertxing/subscriptions","organizations_url":"https://api.github.com/users/albertxing/orgs","repos_url":"https://api.github.com/users/albertxing/repos","events_url":"https://api.github.com/users/albertxing/events{/privacy}","received_events_url":"https://api.github.com/users/albertxing/received_events","type":"User","site_admin":false},"repo":{"id":19871505,"name":"brackets","full_name":"albertxing/brackets","owner":{"login":"albertxing","id":2881206,"avatar_url":"https://avatars.githubusercontent.com/u/2881206?","gravatar_id":"7e5976a9d93cdaf6183e6e445c460b73","url":"https://api.github.com/users/albertxing","html_url":"https://github.com/albertxing","followers_url":"https://api.github.com/users/albertxing/followers","following_url":"https://api.github.com/users/albertxing/following{/other_user}","gists_url":"https://api.github.com/users/albertxing/gists{/gist_id}","starred_url":"https://api.github.com/users/albertxing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/albertxing/subscriptions","organizations_url":"https://api.github.com/users/albertxing/orgs","repos_url":"https://api.github.com/users/albertxing/repos","events_url":"https://api.github.com/users/albertxing/events{/privacy}","received_events_url":"https://api.github.com/users/albertxing/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/albertxing/brackets","description":"An open source code editor for the web, written in JavaScript, HTML and CSS.","fork":true,"url":"https://api.github.com/repos/albertxing/brackets","forks_url":"https://api.github.com/repos/albertxing/brackets/forks","keys_url":"https://api.github.com/repos/albertxing/brackets/keys{/key_id}","collaborators_url":"https://api.github.com/repos/albertxing/brackets/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/albertxing/brackets/teams","hooks_url":"https://api.github.com/repos/albertxing/brackets/hooks","issue_events_url":"https://api.github.com/repos/albertxing/brackets/issues/events{/number}","events_url":"https://api.github.com/repos/albertxing/brackets/events","assignees_url":"https://api.github.com/repos/albertxing/brackets/assignees{/user}","branches_url":"https://api.github.com/repos/albertxing/brackets/branches{/branch}","tags_url":"https://api.github.com/repos/albertxing/brackets/tags","blobs_url":"https://api.github.com/repos/albertxing/brackets/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/albertxing/brackets/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/albertxing/brackets/git/refs{/sha}","trees_url":"https://api.github.com/repos/albertxing/brackets/git/trees{/sha}","statuses_url":"https://api.github.com/repos/albertxing/brackets/statuses/{sha}","languages_url":"https://api.github.com/repos/albertxing/brackets/languages","stargazers_url":"https://api.github.com/repos/albertxing/brackets/stargazers","contributors_url":"https://api.github.com/repos/albertxing/brackets/contributors","subscribers_url":"https://api.github.com/repos/albertxing/brackets/subscribers","subscription_url":"https://api.github.com/repos/albertxing/brackets/subscription","commits_url":"https://api.github.com/repos/albertxing/brackets/commits{/sha}","git_commits_url":"https://api.github.com/repos/albertxing/brackets/git/commits{/sha}","comments_url":"https://api.github.com/repos/albertxing/brackets/comments{/number}","issue_comment_url":"https://api.github.com/repos/albertxing/brackets/issues/comments/{number}","contents_url":"https://api.github.com/repos/albertxing/brackets/contents/{+path}","compare_url":"https://api.github.com/repos/albertxing/brackets/compare/{base}...{head}","merges_url":"https://api.github.com/repos/albertxing/brackets/merges","archive_url":"https://api.github.com/repos/albertxing/brackets/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/albertxing/brackets/downloads","issues_url":"https://api.github.com/repos/albertxing/brackets/issues{/number}","pulls_url":"https://api.github.com/repos/albertxing/brackets/pulls{/number}","milestones_url":"https://api.github.com/repos/albertxing/brackets/milestones{/number}","notifications_url":"https://api.github.com/repos/albertxing/brackets/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/albertxing/brackets/labels{/name}","releases_url":"https://api.github.com/repos/albertxing/brackets/releases{/id}","created_at":"2014-05-16T21:38:43Z","updated_at":"2014-06-09T16:42:56Z","pushed_at":"2014-06-09T16:42:59Z","git_url":"git://github.com/albertxing/brackets.git","ssh_url":"git@github.com:albertxing/brackets.git","clone_url":"https://github.com/albertxing/brackets.git","svn_url":"https://github.com/albertxing/brackets","homepage":"http://brackets.io","size":61433,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"adobe:master","ref":"master","sha":"085893af14d77c2d414aad7c0ea723c84b9ec3f6","user":{"login":"adobe","id":476009,"avatar_url":"https://avatars.githubusercontent.com/u/476009?","gravatar_id":"cc40327f6f93a7b75207a152962d8dbe","url":"https://api.github.com/users/adobe","html_url":"https://github.com/adobe","followers_url":"https://api.github.com/users/adobe/followers","following_url":"https://api.github.com/users/adobe/following{/other_user}","gists_url":"https://api.github.com/users/adobe/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe/subscriptions","organizations_url":"https://api.github.com/users/adobe/orgs","repos_url":"https://api.github.com/users/adobe/repos","events_url":"https://api.github.com/users/adobe/events{/privacy}","received_events_url":"https://api.github.com/users/adobe/received_events","type":"Organization","site_admin":false},"repo":{"id":2935735,"name":"brackets","full_name":"adobe/brackets","owner":{"login":"adobe","id":476009,"avatar_url":"https://avatars.githubusercontent.com/u/476009?","gravatar_id":"cc40327f6f93a7b75207a152962d8dbe","url":"https://api.github.com/users/adobe","html_url":"https://github.com/adobe","followers_url":"https://api.github.com/users/adobe/followers","following_url":"https://api.github.com/users/adobe/following{/other_user}","gists_url":"https://api.github.com/users/adobe/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe/subscriptions","organizations_url":"https://api.github.com/users/adobe/orgs","repos_url":"https://api.github.com/users/adobe/repos","events_url":"https://api.github.com/users/adobe/events{/privacy}","received_events_url":"https://api.github.com/users/adobe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/adobe/brackets","description":"An open source code editor for the web, written in JavaScript, HTML and CSS.","fork":false,"url":"https://api.github.com/repos/adobe/brackets","forks_url":"https://api.github.com/repos/adobe/brackets/forks","keys_url":"https://api.github.com/repos/adobe/brackets/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adobe/brackets/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adobe/brackets/teams","hooks_url":"https://api.github.com/repos/adobe/brackets/hooks","issue_events_url":"https://api.github.com/repos/adobe/brackets/issues/events{/number}","events_url":"https://api.github.com/repos/adobe/brackets/events","assignees_url":"https://api.github.com/repos/adobe/brackets/assignees{/user}","branches_url":"https://api.github.com/repos/adobe/brackets/branches{/branch}","tags_url":"https://api.github.com/repos/adobe/brackets/tags","blobs_url":"https://api.github.com/repos/adobe/brackets/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adobe/brackets/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adobe/brackets/git/refs{/sha}","trees_url":"https://api.github.com/repos/adobe/brackets/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adobe/brackets/statuses/{sha}","languages_url":"https://api.github.com/repos/adobe/brackets/languages","stargazers_url":"https://api.github.com/repos/adobe/brackets/stargazers","contributors_url":"https://api.github.com/repos/adobe/brackets/contributors","subscribers_url":"https://api.github.com/repos/adobe/brackets/subscribers","subscription_url":"https://api.github.com/repos/adobe/brackets/subscription","commits_url":"https://api.github.com/repos/adobe/brackets/commits{/sha}","git_commits_url":"https://api.github.com/repos/adobe/brackets/git/commits{/sha}","comments_url":"https://api.github.com/repos/adobe/brackets/comments{/number}","issue_comment_url":"https://api.github.com/repos/adobe/brackets/issues/comments/{number}","contents_url":"https://api.github.com/repos/adobe/brackets/contents/{+path}","compare_url":"https://api.github.com/repos/adobe/brackets/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adobe/brackets/merges","archive_url":"https://api.github.com/repos/adobe/brackets/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adobe/brackets/downloads","issues_url":"https://api.github.com/repos/adobe/brackets/issues{/number}","pulls_url":"https://api.github.com/repos/adobe/brackets/pulls{/number}","milestones_url":"https://api.github.com/repos/adobe/brackets/milestones{/number}","notifications_url":"https://api.github.com/repos/adobe/brackets/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adobe/brackets/labels{/name}","releases_url":"https://api.github.com/repos/adobe/brackets/releases{/id}","created_at":"2011-12-07T21:14:40Z","updated_at":"2014-06-09T22:09:49Z","pushed_at":"2014-06-09T22:09:50Z","git_url":"git://github.com/adobe/brackets.git","ssh_url":"git@github.com:adobe/brackets.git","clone_url":"https://github.com/adobe/brackets.git","svn_url":"https://github.com/adobe/brackets","homepage":"http://brackets.io","size":286276,"stargazers_count":16418,"watchers_count":16418,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":3349,"mirror_url":null,"open_issues_count":849,"forks":3349,"open_issues":849,"watchers":16418,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/adobe/brackets/pulls/7875"},"html":{"href":"https://github.com/adobe/brackets/pull/7875"},"issue":{"href":"https://api.github.com/repos/adobe/brackets/issues/7875"},"comments":{"href":"https://api.github.com/repos/adobe/brackets/issues/7875/comments"},"review_comments":{"href":"https://api.github.com/repos/adobe/brackets/pulls/7875/comments"},"review_comment":{"href":"https://api.github.com/repos/adobe/brackets/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/adobe/brackets/pulls/7875/commits"},"statuses":{"href":"https://api.github.com/repos/adobe/brackets/statuses/9da42e7e97567dd21f000527b99387f9dd4982e1"}}}}