{"action":"created","comment":{"url":"https://api.github.com/repos/mu-editor/mu/pulls/comments/82774708","pull_request_review_id":3656501,"id":82774708,"diff_hunk":"@@ -809,16 +850,55 @@ def process_bytes(self, bs):\n         # then move it there.\n         while tc.movePosition(QTextCursor.Down):\n             pass\n-        for b in bs:\n-            if b == 8:  # \\b\n+\n+        i = 0\n+        while i < len(data):\n+            if data[i] == 8:  # \\b\n                 tc.movePosition(QTextCursor.Left)\n                 self.setTextCursor(tc)\n-            elif b == 13:  # \\r\n+            elif data[i] == 13:  # \\r\n                 pass\n+            elif data[i] == 27 and data[i + 1] == 91:  # VT100 cursor: <Esc>[\n+                i += 2  # move index to after the [\n+                m = re.search(r'(?P<count>[\\d]*)(?P<action>[ABCDK])',\n+                              data[i:].decode('utf-8'))\n+\n+                # move to (almost) after control seq (will ++ at end of loop)\n+                i += m.end() - 1\n+\n+                if m.group(\"count\") == '':","path":"mu/interface.py","position":134,"original_position":134,"commit_id":"f3a0c21e8e94573150eee19354cfd65d4015e67b","original_commit_id":"f3a0c21e8e94573150eee19354cfd65d4015e67b","user":{"login":"carlosperate","id":4189262,"avatar_url":"https://avatars.githubusercontent.com/u/4189262?v=3","gravatar_id":"","url":"https://api.github.com/users/carlosperate","html_url":"https://github.com/carlosperate","followers_url":"https://api.github.com/users/carlosperate/followers","following_url":"https://api.github.com/users/carlosperate/following{/other_user}","gists_url":"https://api.github.com/users/carlosperate/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosperate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosperate/subscriptions","organizations_url":"https://api.github.com/users/carlosperate/orgs","repos_url":"https://api.github.com/users/carlosperate/repos","events_url":"https://api.github.com/users/carlosperate/events{/privacy}","received_events_url":"https://api.github.com/users/carlosperate/received_events","type":"User","site_admin":false},"body":"If you prefer, this could be a bit more pythonic with\r\n\r\n```python\r\ncount = 1 if not m.group(\"count\") else int(m.group(\"count\"))\r\n```","created_at":"2016-10-11T11:41:59Z","updated_at":"2016-10-11T11:41:59Z","html_url":"https://github.com/mu-editor/mu/pull/167#discussion_r82774708","pull_request_url":"https://api.github.com/repos/mu-editor/mu/pulls/167","_links":{"self":{"href":"https://api.github.com/repos/mu-editor/mu/pulls/comments/82774708"},"html":{"href":"https://github.com/mu-editor/mu/pull/167#discussion_r82774708"},"pull_request":{"href":"https://api.github.com/repos/mu-editor/mu/pulls/167"}}},"pull_request":{"url":"https://api.github.com/repos/mu-editor/mu/pulls/167","id":88569621,"html_url":"https://github.com/mu-editor/mu/pull/167","diff_url":"https://github.com/mu-editor/mu/pull/167.diff","patch_url":"https://github.com/mu-editor/mu/pull/167.patch","issue_url":"https://api.github.com/repos/mu-editor/mu/issues/167","number":167,"state":"open","locked":false,"title":"Fix Ctrl keys to work on Windows and Linux; add VT100 cursor control in REPL","user":{"login":"eduvik","id":5643098,"avatar_url":"https://avatars.githubusercontent.com/u/5643098?v=3","gravatar_id":"","url":"https://api.github.com/users/eduvik","html_url":"https://github.com/eduvik","followers_url":"https://api.github.com/users/eduvik/followers","following_url":"https://api.github.com/users/eduvik/following{/other_user}","gists_url":"https://api.github.com/users/eduvik/gists{/gist_id}","starred_url":"https://api.github.com/users/eduvik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eduvik/subscriptions","organizations_url":"https://api.github.com/users/eduvik/orgs","repos_url":"https://api.github.com/users/eduvik/repos","events_url":"https://api.github.com/users/eduvik/events{/privacy}","received_events_url":"https://api.github.com/users/eduvik/received_events","type":"User","site_admin":false},"body":"Not tested on microbit, but equivalent code from my esp8266 fork works fine. ","created_at":"2016-10-09T05:43:18Z","updated_at":"2016-10-11T11:44:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d21001e525114a6eb9ecc23c826553a259b6d407","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mu-editor/mu/pulls/167/commits","review_comments_url":"https://api.github.com/repos/mu-editor/mu/pulls/167/comments","review_comment_url":"https://api.github.com/repos/mu-editor/mu/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mu-editor/mu/issues/167/comments","statuses_url":"https://api.github.com/repos/mu-editor/mu/statuses/f3a0c21e8e94573150eee19354cfd65d4015e67b","head":{"label":"eduvik:bugfix/control-keys-repl","ref":"bugfix/control-keys-repl","sha":"f3a0c21e8e94573150eee19354cfd65d4015e67b","user":{"login":"eduvik","id":5643098,"avatar_url":"https://avatars.githubusercontent.com/u/5643098?v=3","gravatar_id":"","url":"https://api.github.com/users/eduvik","html_url":"https://github.com/eduvik","followers_url":"https://api.github.com/users/eduvik/followers","following_url":"https://api.github.com/users/eduvik/following{/other_user}","gists_url":"https://api.github.com/users/eduvik/gists{/gist_id}","starred_url":"https://api.github.com/users/eduvik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eduvik/subscriptions","organizations_url":"https://api.github.com/users/eduvik/orgs","repos_url":"https://api.github.com/users/eduvik/repos","events_url":"https://api.github.com/users/eduvik/events{/privacy}","received_events_url":"https://api.github.com/users/eduvik/received_events","type":"User","site_admin":false},"repo":{"id":64365893,"name":"mu","full_name":"eduvik/mu","owner":{"login":"eduvik","id":5643098,"avatar_url":"https://avatars.githubusercontent.com/u/5643098?v=3","gravatar_id":"","url":"https://api.github.com/users/eduvik","html_url":"https://github.com/eduvik","followers_url":"https://api.github.com/users/eduvik/followers","following_url":"https://api.github.com/users/eduvik/following{/other_user}","gists_url":"https://api.github.com/users/eduvik/gists{/gist_id}","starred_url":"https://api.github.com/users/eduvik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eduvik/subscriptions","organizations_url":"https://api.github.com/users/eduvik/orgs","repos_url":"https://api.github.com/users/eduvik/repos","events_url":"https://api.github.com/users/eduvik/events{/privacy}","received_events_url":"https://api.github.com/users/eduvik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eduvik/mu","description":"A \"micro\" editor for MicroPython and the BBC micro:bit - this fork targets the ESP8266 and other micropython boards - switch to the feature/multi-board branch to use this. Written in Python and Qt5.","fork":true,"url":"https://api.github.com/repos/eduvik/mu","forks_url":"https://api.github.com/repos/eduvik/mu/forks","keys_url":"https://api.github.com/repos/eduvik/mu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eduvik/mu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eduvik/mu/teams","hooks_url":"https://api.github.com/repos/eduvik/mu/hooks","issue_events_url":"https://api.github.com/repos/eduvik/mu/issues/events{/number}","events_url":"https://api.github.com/repos/eduvik/mu/events","assignees_url":"https://api.github.com/repos/eduvik/mu/assignees{/user}","branches_url":"https://api.github.com/repos/eduvik/mu/branches{/branch}","tags_url":"https://api.github.com/repos/eduvik/mu/tags","blobs_url":"https://api.github.com/repos/eduvik/mu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eduvik/mu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eduvik/mu/git/refs{/sha}","trees_url":"https://api.github.com/repos/eduvik/mu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eduvik/mu/statuses/{sha}","languages_url":"https://api.github.com/repos/eduvik/mu/languages","stargazers_url":"https://api.github.com/repos/eduvik/mu/stargazers","contributors_url":"https://api.github.com/repos/eduvik/mu/contributors","subscribers_url":"https://api.github.com/repos/eduvik/mu/subscribers","subscription_url":"https://api.github.com/repos/eduvik/mu/subscription","commits_url":"https://api.github.com/repos/eduvik/mu/commits{/sha}","git_commits_url":"https://api.github.com/repos/eduvik/mu/git/commits{/sha}","comments_url":"https://api.github.com/repos/eduvik/mu/comments{/number}","issue_comment_url":"https://api.github.com/repos/eduvik/mu/issues/comments{/number}","contents_url":"https://api.github.com/repos/eduvik/mu/contents/{+path}","compare_url":"https://api.github.com/repos/eduvik/mu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eduvik/mu/merges","archive_url":"https://api.github.com/repos/eduvik/mu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eduvik/mu/downloads","issues_url":"https://api.github.com/repos/eduvik/mu/issues{/number}","pulls_url":"https://api.github.com/repos/eduvik/mu/pulls{/number}","milestones_url":"https://api.github.com/repos/eduvik/mu/milestones{/number}","notifications_url":"https://api.github.com/repos/eduvik/mu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eduvik/mu/labels{/name}","releases_url":"https://api.github.com/repos/eduvik/mu/releases{/id}","deployments_url":"https://api.github.com/repos/eduvik/mu/deployments","created_at":"2016-07-28T05:04:29Z","updated_at":"2016-10-07T19:54:19Z","pushed_at":"2016-10-11T10:30:31Z","git_url":"git://github.com/eduvik/mu.git","ssh_url":"git@github.com:eduvik/mu.git","clone_url":"https://github.com/eduvik/mu.git","svn_url":"https://github.com/eduvik/mu","homepage":"","size":4217,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":5,"forks":1,"open_issues":5,"watchers":8,"default_branch":"master"}},"base":{"label":"mu-editor:master","ref":"master","sha":"7c6456a6256de7a7ce5ed01b9193980e582efe35","user":{"login":"mu-editor","id":17850097,"avatar_url":"https://avatars.githubusercontent.com/u/17850097?v=3","gravatar_id":"","url":"https://api.github.com/users/mu-editor","html_url":"https://github.com/mu-editor","followers_url":"https://api.github.com/users/mu-editor/followers","following_url":"https://api.github.com/users/mu-editor/following{/other_user}","gists_url":"https://api.github.com/users/mu-editor/gists{/gist_id}","starred_url":"https://api.github.com/users/mu-editor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mu-editor/subscriptions","organizations_url":"https://api.github.com/users/mu-editor/orgs","repos_url":"https://api.github.com/users/mu-editor/repos","events_url":"https://api.github.com/users/mu-editor/events{/privacy}","received_events_url":"https://api.github.com/users/mu-editor/received_events","type":"Organization","site_admin":false},"repo":{"id":47607357,"name":"mu","full_name":"mu-editor/mu","owner":{"login":"mu-editor","id":17850097,"avatar_url":"https://avatars.githubusercontent.com/u/17850097?v=3","gravatar_id":"","url":"https://api.github.com/users/mu-editor","html_url":"https://github.com/mu-editor","followers_url":"https://api.github.com/users/mu-editor/followers","following_url":"https://api.github.com/users/mu-editor/following{/other_user}","gists_url":"https://api.github.com/users/mu-editor/gists{/gist_id}","starred_url":"https://api.github.com/users/mu-editor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mu-editor/subscriptions","organizations_url":"https://api.github.com/users/mu-editor/orgs","repos_url":"https://api.github.com/users/mu-editor/repos","events_url":"https://api.github.com/users/mu-editor/events{/privacy}","received_events_url":"https://api.github.com/users/mu-editor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mu-editor/mu","description":"A \"micro\" editor for MicroPython and the BBC micro:bit. Written in Python and Qt5.","fork":false,"url":"https://api.github.com/repos/mu-editor/mu","forks_url":"https://api.github.com/repos/mu-editor/mu/forks","keys_url":"https://api.github.com/repos/mu-editor/mu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mu-editor/mu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mu-editor/mu/teams","hooks_url":"https://api.github.com/repos/mu-editor/mu/hooks","issue_events_url":"https://api.github.com/repos/mu-editor/mu/issues/events{/number}","events_url":"https://api.github.com/repos/mu-editor/mu/events","assignees_url":"https://api.github.com/repos/mu-editor/mu/assignees{/user}","branches_url":"https://api.github.com/repos/mu-editor/mu/branches{/branch}","tags_url":"https://api.github.com/repos/mu-editor/mu/tags","blobs_url":"https://api.github.com/repos/mu-editor/mu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mu-editor/mu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mu-editor/mu/git/refs{/sha}","trees_url":"https://api.github.com/repos/mu-editor/mu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mu-editor/mu/statuses/{sha}","languages_url":"https://api.github.com/repos/mu-editor/mu/languages","stargazers_url":"https://api.github.com/repos/mu-editor/mu/stargazers","contributors_url":"https://api.github.com/repos/mu-editor/mu/contributors","subscribers_url":"https://api.github.com/repos/mu-editor/mu/subscribers","subscription_url":"https://api.github.com/repos/mu-editor/mu/subscription","commits_url":"https://api.github.com/repos/mu-editor/mu/commits{/sha}","git_commits_url":"https://api.github.com/repos/mu-editor/mu/git/commits{/sha}","comments_url":"https://api.github.com/repos/mu-editor/mu/comments{/number}","issue_comment_url":"https://api.github.com/repos/mu-editor/mu/issues/comments{/number}","contents_url":"https://api.github.com/repos/mu-editor/mu/contents/{+path}","compare_url":"https://api.github.com/repos/mu-editor/mu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mu-editor/mu/merges","archive_url":"https://api.github.com/repos/mu-editor/mu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mu-editor/mu/downloads","issues_url":"https://api.github.com/repos/mu-editor/mu/issues{/number}","pulls_url":"https://api.github.com/repos/mu-editor/mu/pulls{/number}","milestones_url":"https://api.github.com/repos/mu-editor/mu/milestones{/number}","notifications_url":"https://api.github.com/repos/mu-editor/mu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mu-editor/mu/labels{/name}","releases_url":"https://api.github.com/repos/mu-editor/mu/releases{/id}","deployments_url":"https://api.github.com/repos/mu-editor/mu/deployments","created_at":"2015-12-08T07:56:02Z","updated_at":"2016-10-08T11:25:07Z","pushed_at":"2016-10-11T10:29:35Z","git_url":"git://github.com/mu-editor/mu.git","ssh_url":"git@github.com:mu-editor/mu.git","clone_url":"https://github.com/mu-editor/mu.git","svn_url":"https://github.com/mu-editor/mu","homepage":"http://codewith.mu","size":4239,"stargazers_count":69,"watchers_count":69,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":69,"forks":36,"open_issues":69,"watchers":69,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mu-editor/mu/pulls/167"},"html":{"href":"https://github.com/mu-editor/mu/pull/167"},"issue":{"href":"https://api.github.com/repos/mu-editor/mu/issues/167"},"comments":{"href":"https://api.github.com/repos/mu-editor/mu/issues/167/comments"},"review_comments":{"href":"https://api.github.com/repos/mu-editor/mu/pulls/167/comments"},"review_comment":{"href":"https://api.github.com/repos/mu-editor/mu/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mu-editor/mu/pulls/167/commits"},"statuses":{"href":"https://api.github.com/repos/mu-editor/mu/statuses/f3a0c21e8e94573150eee19354cfd65d4015e67b"}}}}
{"actor":{"display_login":"carlosperate"}}