{"action":"closed","number":273,"pull_request":{"url":"https://api.github.com/repos/nothings/stb/pulls/273","id":65051758,"html_url":"https://github.com/nothings/stb/pull/273","diff_url":"https://github.com/nothings/stb/pull/273.diff","patch_url":"https://github.com/nothings/stb/pull/273.patch","issue_url":"https://api.github.com/repos/nothings/stb/issues/273","number":273,"state":"closed","locked":false,"title":"stb_textedit: Add support for custom move word left/right handlers","user":{"login":"ocornut","id":8225057,"avatar_url":"https://avatars.githubusercontent.com/u/8225057?v=3","gravatar_id":"","url":"https://api.github.com/users/ocornut","html_url":"https://github.com/ocornut","followers_url":"https://api.github.com/users/ocornut/followers","following_url":"https://api.github.com/users/ocornut/following{/other_user}","gists_url":"https://api.github.com/users/ocornut/gists{/gist_id}","starred_url":"https://api.github.com/users/ocornut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocornut/subscriptions","organizations_url":"https://api.github.com/users/ocornut/orgs","repos_url":"https://api.github.com/users/ocornut/repos","events_url":"https://api.github.com/users/ocornut/events{/privacy}","received_events_url":"https://api.github.com/users/ocornut/received_events","type":"User","site_admin":false},"body":"*EDIT* Minor edits applied since first posting.\r\n\r\nSorry to submit that right after you've done a bunch yesterday!\r\n\r\nThis patch allows the user to optionally define two functions to override ctrl-arrow style per-word movement, `STB_TEXTEDIT_MOVEWORDLEFT(obj,i)` and `STB_TEXTEDIT_MOVEWORDRIGHT(obj,i)`\r\n\r\n`STB_TEXTEDIT_IS_SPACE(ch)` is still supported and will generate default handlers for those, matching the existing code.\r\n\r\nThe reasoning is to allow applications to:\r\n- Support OS X style word-jumping (move-to-next-word moves to the end of the current word instead of moving you to the beginning of the next word) to have an app be more friendly to OS. Someone made various mods to ImGui to match OS X behaviour and that was the only change they wanted that had to be done on textedit-side.\r\n- Perform other/custom tailored word-jumping, where different tokens in a programming language may lead to slightly different moving behaviour.\r\n\r\nMinor notes:\r\n\r\n- I called them MOVEWORDLEFT/MOVEWORDRIGHT to match the WORDLEFT-WORDRIGHT terminology expressed in the public key definitions, whereas some of the internal code used \"previous\" \"next\". Also note that the existing `STB_TEXTEDIT_IS_SPACE` with underscore should be called ``STB_TEXTEDIT_ISSPACE` to strictly be consistent with the other function names. It doesn't really matter, but that is why the new define don't have underscores.\r\n\r\n- I put the \"burden\" of passing `state->cursor-1` or `state->cursor+1` to the main key handling switch in textedit. Depending what you feel is best, the switch could pass `state->cursor` to both those functions and leave it to the handlers to do -1/+1. It may actually make more sense like that! (just realizing this as I'm typing this message, I could amend the PR for that if you want).\r\n\r\n- Coding style: Some functions near the affected code used `_arg` for function arguments instead of `arg` commonly used in the rest of the code. I haven't changed that to minimize the patch overhead but kept one argument name `c` also to reduce the patch size and make it easier for you to parse it. I'm not sure if there was a reasoning for the extra underscore or if it came accidentally with another patch. While you are there you might want to rename the very few occurences of `_str` to `str` to make the code more consistent.\r\n\r\nThanks!\r\n","created_at":"2016-04-02T22:10:12Z","updated_at":"2016-08-27T19:33:13Z","closed_at":"2016-08-27T19:33:13Z","merged_at":"2016-08-27T19:33:13Z","merge_commit_sha":"75ce29fe0b1d17c05b56a447a78831a9cf585f2e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nothings/stb/pulls/273/commits","review_comments_url":"https://api.github.com/repos/nothings/stb/pulls/273/comments","review_comment_url":"https://api.github.com/repos/nothings/stb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nothings/stb/issues/273/comments","statuses_url":"https://api.github.com/repos/nothings/stb/statuses/75ce29fe0b1d17c05b56a447a78831a9cf585f2e","head":{"label":"ocornut:textedit-moveright-moveleft","ref":"textedit-moveright-moveleft","sha":"75ce29fe0b1d17c05b56a447a78831a9cf585f2e","user":{"login":"ocornut","id":8225057,"avatar_url":"https://avatars.githubusercontent.com/u/8225057?v=3","gravatar_id":"","url":"https://api.github.com/users/ocornut","html_url":"https://github.com/ocornut","followers_url":"https://api.github.com/users/ocornut/followers","following_url":"https://api.github.com/users/ocornut/following{/other_user}","gists_url":"https://api.github.com/users/ocornut/gists{/gist_id}","starred_url":"https://api.github.com/users/ocornut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocornut/subscriptions","organizations_url":"https://api.github.com/users/ocornut/orgs","repos_url":"https://api.github.com/users/ocornut/repos","events_url":"https://api.github.com/users/ocornut/events{/privacy}","received_events_url":"https://api.github.com/users/ocornut/received_events","type":"User","site_admin":false},"repo":{"id":55309336,"name":"stb","full_name":"ocornut/stb","owner":{"login":"ocornut","id":8225057,"avatar_url":"https://avatars.githubusercontent.com/u/8225057?v=3","gravatar_id":"","url":"https://api.github.com/users/ocornut","html_url":"https://github.com/ocornut","followers_url":"https://api.github.com/users/ocornut/followers","following_url":"https://api.github.com/users/ocornut/following{/other_user}","gists_url":"https://api.github.com/users/ocornut/gists{/gist_id}","starred_url":"https://api.github.com/users/ocornut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocornut/subscriptions","organizations_url":"https://api.github.com/users/ocornut/orgs","repos_url":"https://api.github.com/users/ocornut/repos","events_url":"https://api.github.com/users/ocornut/events{/privacy}","received_events_url":"https://api.github.com/users/ocornut/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ocornut/stb","description":"stb single-file public domain libraries for C/C++","fork":true,"url":"https://api.github.com/repos/ocornut/stb","forks_url":"https://api.github.com/repos/ocornut/stb/forks","keys_url":"https://api.github.com/repos/ocornut/stb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ocornut/stb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ocornut/stb/teams","hooks_url":"https://api.github.com/repos/ocornut/stb/hooks","issue_events_url":"https://api.github.com/repos/ocornut/stb/issues/events{/number}","events_url":"https://api.github.com/repos/ocornut/stb/events","assignees_url":"https://api.github.com/repos/ocornut/stb/assignees{/user}","branches_url":"https://api.github.com/repos/ocornut/stb/branches{/branch}","tags_url":"https://api.github.com/repos/ocornut/stb/tags","blobs_url":"https://api.github.com/repos/ocornut/stb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ocornut/stb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ocornut/stb/git/refs{/sha}","trees_url":"https://api.github.com/repos/ocornut/stb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ocornut/stb/statuses/{sha}","languages_url":"https://api.github.com/repos/ocornut/stb/languages","stargazers_url":"https://api.github.com/repos/ocornut/stb/stargazers","contributors_url":"https://api.github.com/repos/ocornut/stb/contributors","subscribers_url":"https://api.github.com/repos/ocornut/stb/subscribers","subscription_url":"https://api.github.com/repos/ocornut/stb/subscription","commits_url":"https://api.github.com/repos/ocornut/stb/commits{/sha}","git_commits_url":"https://api.github.com/repos/ocornut/stb/git/commits{/sha}","comments_url":"https://api.github.com/repos/ocornut/stb/comments{/number}","issue_comment_url":"https://api.github.com/repos/ocornut/stb/issues/comments{/number}","contents_url":"https://api.github.com/repos/ocornut/stb/contents/{+path}","compare_url":"https://api.github.com/repos/ocornut/stb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ocornut/stb/merges","archive_url":"https://api.github.com/repos/ocornut/stb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ocornut/stb/downloads","issues_url":"https://api.github.com/repos/ocornut/stb/issues{/number}","pulls_url":"https://api.github.com/repos/ocornut/stb/pulls{/number}","milestones_url":"https://api.github.com/repos/ocornut/stb/milestones{/number}","notifications_url":"https://api.github.com/repos/ocornut/stb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ocornut/stb/labels{/name}","releases_url":"https://api.github.com/repos/ocornut/stb/releases{/id}","deployments_url":"https://api.github.com/repos/ocornut/stb/deployments","created_at":"2016-04-02T18:13:19Z","updated_at":"2016-04-02T18:13:21Z","pushed_at":"2016-04-07T13:14:12Z","git_url":"git://github.com/ocornut/stb.git","ssh_url":"git@github.com:ocornut/stb.git","clone_url":"https://github.com/ocornut/stb.git","svn_url":"https://github.com/ocornut/stb","homepage":"","size":2960,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"nothings:master","ref":"master","sha":"5aef2b50aa230eafb34e6ddd0ff6d13dbfd4ad2f","user":{"login":"nothings","id":7525026,"avatar_url":"https://avatars.githubusercontent.com/u/7525026?v=3","gravatar_id":"","url":"https://api.github.com/users/nothings","html_url":"https://github.com/nothings","followers_url":"https://api.github.com/users/nothings/followers","following_url":"https://api.github.com/users/nothings/following{/other_user}","gists_url":"https://api.github.com/users/nothings/gists{/gist_id}","starred_url":"https://api.github.com/users/nothings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nothings/subscriptions","organizations_url":"https://api.github.com/users/nothings/orgs","repos_url":"https://api.github.com/users/nothings/repos","events_url":"https://api.github.com/users/nothings/events{/privacy}","received_events_url":"https://api.github.com/users/nothings/received_events","type":"User","site_admin":false},"repo":{"id":20159867,"name":"stb","full_name":"nothings/stb","owner":{"login":"nothings","id":7525026,"avatar_url":"https://avatars.githubusercontent.com/u/7525026?v=3","gravatar_id":"","url":"https://api.github.com/users/nothings","html_url":"https://github.com/nothings","followers_url":"https://api.github.com/users/nothings/followers","following_url":"https://api.github.com/users/nothings/following{/other_user}","gists_url":"https://api.github.com/users/nothings/gists{/gist_id}","starred_url":"https://api.github.com/users/nothings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nothings/subscriptions","organizations_url":"https://api.github.com/users/nothings/orgs","repos_url":"https://api.github.com/users/nothings/repos","events_url":"https://api.github.com/users/nothings/events{/privacy}","received_events_url":"https://api.github.com/users/nothings/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nothings/stb","description":"stb single-file public domain libraries for C/C++","fork":false,"url":"https://api.github.com/repos/nothings/stb","forks_url":"https://api.github.com/repos/nothings/stb/forks","keys_url":"https://api.github.com/repos/nothings/stb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nothings/stb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nothings/stb/teams","hooks_url":"https://api.github.com/repos/nothings/stb/hooks","issue_events_url":"https://api.github.com/repos/nothings/stb/issues/events{/number}","events_url":"https://api.github.com/repos/nothings/stb/events","assignees_url":"https://api.github.com/repos/nothings/stb/assignees{/user}","branches_url":"https://api.github.com/repos/nothings/stb/branches{/branch}","tags_url":"https://api.github.com/repos/nothings/stb/tags","blobs_url":"https://api.github.com/repos/nothings/stb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nothings/stb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nothings/stb/git/refs{/sha}","trees_url":"https://api.github.com/repos/nothings/stb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nothings/stb/statuses/{sha}","languages_url":"https://api.github.com/repos/nothings/stb/languages","stargazers_url":"https://api.github.com/repos/nothings/stb/stargazers","contributors_url":"https://api.github.com/repos/nothings/stb/contributors","subscribers_url":"https://api.github.com/repos/nothings/stb/subscribers","subscription_url":"https://api.github.com/repos/nothings/stb/subscription","commits_url":"https://api.github.com/repos/nothings/stb/commits{/sha}","git_commits_url":"https://api.github.com/repos/nothings/stb/git/commits{/sha}","comments_url":"https://api.github.com/repos/nothings/stb/comments{/number}","issue_comment_url":"https://api.github.com/repos/nothings/stb/issues/comments{/number}","contents_url":"https://api.github.com/repos/nothings/stb/contents/{+path}","compare_url":"https://api.github.com/repos/nothings/stb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nothings/stb/merges","archive_url":"https://api.github.com/repos/nothings/stb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nothings/stb/downloads","issues_url":"https://api.github.com/repos/nothings/stb/issues{/number}","pulls_url":"https://api.github.com/repos/nothings/stb/pulls{/number}","milestones_url":"https://api.github.com/repos/nothings/stb/milestones{/number}","notifications_url":"https://api.github.com/repos/nothings/stb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nothings/stb/labels{/name}","releases_url":"https://api.github.com/repos/nothings/stb/releases{/id}","deployments_url":"https://api.github.com/repos/nothings/stb/deployments","created_at":"2014-05-25T16:51:23Z","updated_at":"2016-08-27T18:48:44Z","pushed_at":"2016-08-27T19:33:12Z","git_url":"git://github.com/nothings/stb.git","ssh_url":"git@github.com:nothings/stb.git","clone_url":"https://github.com/nothings/stb.git","svn_url":"https://github.com/nothings/stb","homepage":"","size":3460,"stargazers_count":4040,"watchers_count":4040,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":488,"mirror_url":null,"open_issues_count":71,"forks":488,"open_issues":71,"watchers":4040,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nothings/stb/pulls/273"},"html":{"href":"https://github.com/nothings/stb/pull/273"},"issue":{"href":"https://api.github.com/repos/nothings/stb/issues/273"},"comments":{"href":"https://api.github.com/repos/nothings/stb/issues/273/comments"},"review_comments":{"href":"https://api.github.com/repos/nothings/stb/pulls/273/comments"},"review_comment":{"href":"https://api.github.com/repos/nothings/stb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nothings/stb/pulls/273/commits"},"statuses":{"href":"https://api.github.com/repos/nothings/stb/statuses/75ce29fe0b1d17c05b56a447a78831a9cf585f2e"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"nothings","id":7525026,"avatar_url":"https://avatars.githubusercontent.com/u/7525026?v=3","gravatar_id":"","url":"https://api.github.com/users/nothings","html_url":"https://github.com/nothings","followers_url":"https://api.github.com/users/nothings/followers","following_url":"https://api.github.com/users/nothings/following{/other_user}","gists_url":"https://api.github.com/users/nothings/gists{/gist_id}","starred_url":"https://api.github.com/users/nothings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nothings/subscriptions","organizations_url":"https://api.github.com/users/nothings/orgs","repos_url":"https://api.github.com/users/nothings/repos","events_url":"https://api.github.com/users/nothings/events{/privacy}","received_events_url":"https://api.github.com/users/nothings/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"commits":1,"additions":35,"deletions":26,"changed_files":1}}
{"actor":{"display_login":"nothings"}}