{"action":"created","comment":{"url":"https://api.github.com/repos/PistonDevelopers/conrod/pulls/comments/78269423","id":78269423,"diff_hunk":"@@ -575,6 +645,38 @@ impl<'a> Widget for TextEdit<'a> {\n                             }\n                         },\n \n+                        input::Key::End => { // move cursor to end.\n+                            let mut line_infos = state.line_infos.iter().cloned();\n+                            let line = match cursor {\n+                                Cursor::Idx(idx) => idx.line,\n+                                Cursor::Selection {end, ..} => end.line, // use last line of selection\n+                            };\n+                            match line_infos.nth(line) {\n+                                Some(line_info) => {\n+                                    let char = line_info.end_char() - line_info.start_char;\n+                                    let new_cursor_idx = text::cursor::Index { line: line, char: char };\n+                                    cursor = Cursor::Idx(new_cursor_idx);\n+                                },\n+                                _ => (),\n+                            }\n+                        },\n+\n+                        input::Key::Home => { // move cursor to beginning.\n+                            let mut line_infos = state.line_infos.iter().cloned();\n+                            let line = match cursor {\n+                                Cursor::Idx(idx) => idx.line,\n+                                Cursor::Selection {start, ..} => start.line, // use first line of selection\n+                            };\n+                            match line_infos.nth(line) {","path":"src/widget/text_edit.rs","position":103,"original_position":103,"commit_id":"b94d199813131921a8ac0329c35c97dd65391412","original_commit_id":"b94d199813131921a8ac0329c35c97dd65391412","user":{"login":"mitchmindtree","id":4587373,"avatar_url":"https://avatars.githubusercontent.com/u/4587373?v=3","gravatar_id":"","url":"https://api.github.com/users/mitchmindtree","html_url":"https://github.com/mitchmindtree","followers_url":"https://api.github.com/users/mitchmindtree/followers","following_url":"https://api.github.com/users/mitchmindtree/following{/other_user}","gists_url":"https://api.github.com/users/mitchmindtree/gists{/gist_id}","starred_url":"https://api.github.com/users/mitchmindtree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitchmindtree/subscriptions","organizations_url":"https://api.github.com/users/mitchmindtree/orgs","repos_url":"https://api.github.com/users/mitchmindtree/repos","events_url":"https://api.github.com/users/mitchmindtree/events{/privacy}","received_events_url":"https://api.github.com/users/mitchmindtree/received_events","type":"User","site_admin":false},"body":"This match expr could be more concisely expressed as `if line_infos.nth(line).is_some() { ... }`","created_at":"2016-09-10T02:18:04Z","updated_at":"2016-09-10T02:18:04Z","html_url":"https://github.com/PistonDevelopers/conrod/pull/822#discussion_r78269423","pull_request_url":"https://api.github.com/repos/PistonDevelopers/conrod/pulls/822","_links":{"self":{"href":"https://api.github.com/repos/PistonDevelopers/conrod/pulls/comments/78269423"},"html":{"href":"https://github.com/PistonDevelopers/conrod/pull/822#discussion_r78269423"},"pull_request":{"href":"https://api.github.com/repos/PistonDevelopers/conrod/pulls/822"}}},"pull_request":{"url":"https://api.github.com/repos/PistonDevelopers/conrod/pulls/822","id":84715615,"html_url":"https://github.com/PistonDevelopers/conrod/pull/822","diff_url":"https://github.com/PistonDevelopers/conrod/pull/822.diff","patch_url":"https://github.com/PistonDevelopers/conrod/pull/822.patch","issue_url":"https://api.github.com/repos/PistonDevelopers/conrod/issues/822","number":822,"state":"open","locked":false,"title":"Added actions for Delete, Home and End to TextEdit widget","user":{"login":"Boscop","id":535593,"avatar_url":"https://avatars.githubusercontent.com/u/535593?v=3","gravatar_id":"","url":"https://api.github.com/users/Boscop","html_url":"https://github.com/Boscop","followers_url":"https://api.github.com/users/Boscop/followers","following_url":"https://api.github.com/users/Boscop/following{/other_user}","gists_url":"https://api.github.com/users/Boscop/gists{/gist_id}","starred_url":"https://api.github.com/users/Boscop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Boscop/subscriptions","organizations_url":"https://api.github.com/users/Boscop/orgs","repos_url":"https://api.github.com/users/Boscop/repos","events_url":"https://api.github.com/users/Boscop/events{/privacy}","received_events_url":"https://api.github.com/users/Boscop/received_events","type":"User","site_admin":false},"body":"I added the following actions for Delete, Home and End to TextEdit widget:\r\n\r\nDelete:\r\n- no selection: delete char at cursor\r\n- selection: delete selected text\r\n\r\nHome:\r\n- no selection: move cursor to beginning of line\r\n- selection: go to beginning of the line where selection begins\r\n\r\nEnd:\r\n- no selection: move cursor to end of line\r\n- selection: go to end of the line where selection ends\r\n\r\nI'm not very familiar with the internals, I used the code from similar key actions and modified it.. Maybe the common code should be factored out into a function.\r\n\r\nOther actions that I would still like to see:\r\n- shift+left/right: select text by one char at a time\r\n- ctrl+shift+left/right: select text by one word at a time (ctrl+left/right already moves cursor by one word)\r\n- shift+home/end: select text until beginning/end of line\r\n- ctrl+home/end: go to beginning/end of the whole text\r\n- ctrl+shift+home/end: select text until beginning/end of whole text\r\n- double click: select word\r\n- triple click: select line / sentence / paragraph (in code editors it usually selects the line, in browsers the paragraph)","created_at":"2016-09-09T20:40:55Z","updated_at":"2016-09-10T02:18:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"94cd50ac5d478837ce341b443824de271c96b167","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/PistonDevelopers/conrod/pulls/822/commits","review_comments_url":"https://api.github.com/repos/PistonDevelopers/conrod/pulls/822/comments","review_comment_url":"https://api.github.com/repos/PistonDevelopers/conrod/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PistonDevelopers/conrod/issues/822/comments","statuses_url":"https://api.github.com/repos/PistonDevelopers/conrod/statuses/b94d199813131921a8ac0329c35c97dd65391412","head":{"label":"Boscop:master","ref":"master","sha":"b94d199813131921a8ac0329c35c97dd65391412","user":{"login":"Boscop","id":535593,"avatar_url":"https://avatars.githubusercontent.com/u/535593?v=3","gravatar_id":"","url":"https://api.github.com/users/Boscop","html_url":"https://github.com/Boscop","followers_url":"https://api.github.com/users/Boscop/followers","following_url":"https://api.github.com/users/Boscop/following{/other_user}","gists_url":"https://api.github.com/users/Boscop/gists{/gist_id}","starred_url":"https://api.github.com/users/Boscop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Boscop/subscriptions","organizations_url":"https://api.github.com/users/Boscop/orgs","repos_url":"https://api.github.com/users/Boscop/repos","events_url":"https://api.github.com/users/Boscop/events{/privacy}","received_events_url":"https://api.github.com/users/Boscop/received_events","type":"User","site_admin":false},"repo":{"id":67830141,"name":"conrod","full_name":"Boscop/conrod","owner":{"login":"Boscop","id":535593,"avatar_url":"https://avatars.githubusercontent.com/u/535593?v=3","gravatar_id":"","url":"https://api.github.com/users/Boscop","html_url":"https://github.com/Boscop","followers_url":"https://api.github.com/users/Boscop/followers","following_url":"https://api.github.com/users/Boscop/following{/other_user}","gists_url":"https://api.github.com/users/Boscop/gists{/gist_id}","starred_url":"https://api.github.com/users/Boscop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Boscop/subscriptions","organizations_url":"https://api.github.com/users/Boscop/orgs","repos_url":"https://api.github.com/users/Boscop/repos","events_url":"https://api.github.com/users/Boscop/events{/privacy}","received_events_url":"https://api.github.com/users/Boscop/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Boscop/conrod","description":"An easy-to-use, 2D GUI library written entirely in Rust.","fork":true,"url":"https://api.github.com/repos/Boscop/conrod","forks_url":"https://api.github.com/repos/Boscop/conrod/forks","keys_url":"https://api.github.com/repos/Boscop/conrod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Boscop/conrod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Boscop/conrod/teams","hooks_url":"https://api.github.com/repos/Boscop/conrod/hooks","issue_events_url":"https://api.github.com/repos/Boscop/conrod/issues/events{/number}","events_url":"https://api.github.com/repos/Boscop/conrod/events","assignees_url":"https://api.github.com/repos/Boscop/conrod/assignees{/user}","branches_url":"https://api.github.com/repos/Boscop/conrod/branches{/branch}","tags_url":"https://api.github.com/repos/Boscop/conrod/tags","blobs_url":"https://api.github.com/repos/Boscop/conrod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Boscop/conrod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Boscop/conrod/git/refs{/sha}","trees_url":"https://api.github.com/repos/Boscop/conrod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Boscop/conrod/statuses/{sha}","languages_url":"https://api.github.com/repos/Boscop/conrod/languages","stargazers_url":"https://api.github.com/repos/Boscop/conrod/stargazers","contributors_url":"https://api.github.com/repos/Boscop/conrod/contributors","subscribers_url":"https://api.github.com/repos/Boscop/conrod/subscribers","subscription_url":"https://api.github.com/repos/Boscop/conrod/subscription","commits_url":"https://api.github.com/repos/Boscop/conrod/commits{/sha}","git_commits_url":"https://api.github.com/repos/Boscop/conrod/git/commits{/sha}","comments_url":"https://api.github.com/repos/Boscop/conrod/comments{/number}","issue_comment_url":"https://api.github.com/repos/Boscop/conrod/issues/comments{/number}","contents_url":"https://api.github.com/repos/Boscop/conrod/contents/{+path}","compare_url":"https://api.github.com/repos/Boscop/conrod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Boscop/conrod/merges","archive_url":"https://api.github.com/repos/Boscop/conrod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Boscop/conrod/downloads","issues_url":"https://api.github.com/repos/Boscop/conrod/issues{/number}","pulls_url":"https://api.github.com/repos/Boscop/conrod/pulls{/number}","milestones_url":"https://api.github.com/repos/Boscop/conrod/milestones{/number}","notifications_url":"https://api.github.com/repos/Boscop/conrod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Boscop/conrod/labels{/name}","releases_url":"https://api.github.com/repos/Boscop/conrod/releases{/id}","deployments_url":"https://api.github.com/repos/Boscop/conrod/deployments","created_at":"2016-09-09T20:20:46Z","updated_at":"2016-09-09T20:20:49Z","pushed_at":"2016-09-09T20:28:43Z","git_url":"git://github.com/Boscop/conrod.git","ssh_url":"git@github.com:Boscop/conrod.git","clone_url":"https://github.com/Boscop/conrod.git","svn_url":"https://github.com/Boscop/conrod","homepage":"","size":5001,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"PistonDevelopers:master","ref":"master","sha":"fc6cab04753bc416752dad316a0326ca97c4f5aa","user":{"login":"PistonDevelopers","id":7623406,"avatar_url":"https://avatars.githubusercontent.com/u/7623406?v=3","gravatar_id":"","url":"https://api.github.com/users/PistonDevelopers","html_url":"https://github.com/PistonDevelopers","followers_url":"https://api.github.com/users/PistonDevelopers/followers","following_url":"https://api.github.com/users/PistonDevelopers/following{/other_user}","gists_url":"https://api.github.com/users/PistonDevelopers/gists{/gist_id}","starred_url":"https://api.github.com/users/PistonDevelopers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PistonDevelopers/subscriptions","organizations_url":"https://api.github.com/users/PistonDevelopers/orgs","repos_url":"https://api.github.com/users/PistonDevelopers/repos","events_url":"https://api.github.com/users/PistonDevelopers/events{/privacy}","received_events_url":"https://api.github.com/users/PistonDevelopers/received_events","type":"Organization","site_admin":false},"repo":{"id":20829815,"name":"conrod","full_name":"PistonDevelopers/conrod","owner":{"login":"PistonDevelopers","id":7623406,"avatar_url":"https://avatars.githubusercontent.com/u/7623406?v=3","gravatar_id":"","url":"https://api.github.com/users/PistonDevelopers","html_url":"https://github.com/PistonDevelopers","followers_url":"https://api.github.com/users/PistonDevelopers/followers","following_url":"https://api.github.com/users/PistonDevelopers/following{/other_user}","gists_url":"https://api.github.com/users/PistonDevelopers/gists{/gist_id}","starred_url":"https://api.github.com/users/PistonDevelopers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PistonDevelopers/subscriptions","organizations_url":"https://api.github.com/users/PistonDevelopers/orgs","repos_url":"https://api.github.com/users/PistonDevelopers/repos","events_url":"https://api.github.com/users/PistonDevelopers/events{/privacy}","received_events_url":"https://api.github.com/users/PistonDevelopers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PistonDevelopers/conrod","description":"An easy-to-use, 2D GUI library written entirely in Rust.","fork":false,"url":"https://api.github.com/repos/PistonDevelopers/conrod","forks_url":"https://api.github.com/repos/PistonDevelopers/conrod/forks","keys_url":"https://api.github.com/repos/PistonDevelopers/conrod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PistonDevelopers/conrod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PistonDevelopers/conrod/teams","hooks_url":"https://api.github.com/repos/PistonDevelopers/conrod/hooks","issue_events_url":"https://api.github.com/repos/PistonDevelopers/conrod/issues/events{/number}","events_url":"https://api.github.com/repos/PistonDevelopers/conrod/events","assignees_url":"https://api.github.com/repos/PistonDevelopers/conrod/assignees{/user}","branches_url":"https://api.github.com/repos/PistonDevelopers/conrod/branches{/branch}","tags_url":"https://api.github.com/repos/PistonDevelopers/conrod/tags","blobs_url":"https://api.github.com/repos/PistonDevelopers/conrod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PistonDevelopers/conrod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PistonDevelopers/conrod/git/refs{/sha}","trees_url":"https://api.github.com/repos/PistonDevelopers/conrod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PistonDevelopers/conrod/statuses/{sha}","languages_url":"https://api.github.com/repos/PistonDevelopers/conrod/languages","stargazers_url":"https://api.github.com/repos/PistonDevelopers/conrod/stargazers","contributors_url":"https://api.github.com/repos/PistonDevelopers/conrod/contributors","subscribers_url":"https://api.github.com/repos/PistonDevelopers/conrod/subscribers","subscription_url":"https://api.github.com/repos/PistonDevelopers/conrod/subscription","commits_url":"https://api.github.com/repos/PistonDevelopers/conrod/commits{/sha}","git_commits_url":"https://api.github.com/repos/PistonDevelopers/conrod/git/commits{/sha}","comments_url":"https://api.github.com/repos/PistonDevelopers/conrod/comments{/number}","issue_comment_url":"https://api.github.com/repos/PistonDevelopers/conrod/issues/comments{/number}","contents_url":"https://api.github.com/repos/PistonDevelopers/conrod/contents/{+path}","compare_url":"https://api.github.com/repos/PistonDevelopers/conrod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PistonDevelopers/conrod/merges","archive_url":"https://api.github.com/repos/PistonDevelopers/conrod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PistonDevelopers/conrod/downloads","issues_url":"https://api.github.com/repos/PistonDevelopers/conrod/issues{/number}","pulls_url":"https://api.github.com/repos/PistonDevelopers/conrod/pulls{/number}","milestones_url":"https://api.github.com/repos/PistonDevelopers/conrod/milestones{/number}","notifications_url":"https://api.github.com/repos/PistonDevelopers/conrod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PistonDevelopers/conrod/labels{/name}","releases_url":"https://api.github.com/repos/PistonDevelopers/conrod/releases{/id}","deployments_url":"https://api.github.com/repos/PistonDevelopers/conrod/deployments","created_at":"2014-06-14T10:25:10Z","updated_at":"2016-09-09T20:32:52Z","pushed_at":"2016-09-09T20:40:55Z","git_url":"git://github.com/PistonDevelopers/conrod.git","ssh_url":"git@github.com:PistonDevelopers/conrod.git","clone_url":"https://github.com/PistonDevelopers/conrod.git","svn_url":"https://github.com/PistonDevelopers/conrod","homepage":"","size":5762,"stargazers_count":773,"watchers_count":773,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":95,"mirror_url":null,"open_issues_count":99,"forks":95,"open_issues":99,"watchers":773,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PistonDevelopers/conrod/pulls/822"},"html":{"href":"https://github.com/PistonDevelopers/conrod/pull/822"},"issue":{"href":"https://api.github.com/repos/PistonDevelopers/conrod/issues/822"},"comments":{"href":"https://api.github.com/repos/PistonDevelopers/conrod/issues/822/comments"},"review_comments":{"href":"https://api.github.com/repos/PistonDevelopers/conrod/pulls/822/comments"},"review_comment":{"href":"https://api.github.com/repos/PistonDevelopers/conrod/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PistonDevelopers/conrod/pulls/822/commits"},"statuses":{"href":"https://api.github.com/repos/PistonDevelopers/conrod/statuses/b94d199813131921a8ac0329c35c97dd65391412"}}}}
{"actor":{"display_login":"mitchmindtree"}}