{"action":"closed","issue":{"url":"https://api.github.com/repos/jquast/blessed/issues/29","labels_url":"https://api.github.com/repos/jquast/blessed/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/jquast/blessed/issues/29/comments","events_url":"https://api.github.com/repos/jquast/blessed/issues/29/events","html_url":"https://github.com/jquast/blessed/issues/29","id":50217218,"number":29,"title":"iter_parse method","user":{"login":"jquast","id":972584,"avatar_url":"https://avatars.githubusercontent.com/u/972584?v=3","gravatar_id":"","url":"https://api.github.com/users/jquast","html_url":"https://github.com/jquast","followers_url":"https://api.github.com/users/jquast/followers","following_url":"https://api.github.com/users/jquast/following{/other_user}","gists_url":"https://api.github.com/users/jquast/gists{/gist_id}","starred_url":"https://api.github.com/users/jquast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jquast/subscriptions","organizations_url":"https://api.github.com/users/jquast/orgs","repos_url":"https://api.github.com/users/jquast/repos","events_url":"https://api.github.com/users/jquast/events{/privacy}","received_events_url":"https://api.github.com/users/jquast/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jquast/blessed/labels/enhancement","name":"enhancement","color":"5319e7"},{"url":"https://api.github.com/repos/jquast/blessed/labels/M","name":"M","color":"bfd4f2"},{"url":"https://api.github.com/repos/jquast/blessed/labels/needs-code","name":"needs-code","color":"fad8c7"},{"url":"https://api.github.com/repos/jquast/blessed/labels/needs-tests","name":"needs-tests","color":"fad8c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2014-11-26T19:20:08Z","updated_at":"2015-11-08T21:20:43Z","closed_at":"2015-11-08T21:20:43Z","body":"Acceptance Criteria\r\n--------------------------\r\n\r\nA method, ``term.iter_parse()``, that can be used in the following manner:\r\n```\r\n>>> for part in Terminal().iter_parse('\\x1b[10Cblahblah\\x1b[0m'):\r\n...    print((ucs, ucs.is_sequence, ucs.capname, ucs.params))\r\n...\r\n('\\x1b[10C', True, 'cuf', ('10',))\r\n('blahblah', False, None, None))\r\n('\\x1b[0m', True, 'sgr', ('0',))\r\n```\r\n\r\nThere are several places in the codebase where sequences are \"iterated\", these sections of code should be replaced by the new ``iter_parse(term, ucs)`` function added to blessings/sequences.py, and proxying stub method added to the Terminal class.\r\n\r\nDetails\r\n----------\r\n\r\nOne thing blessed does right now is simply emit or strip sequences, but it doesn't \"comprehend\" them in the way curtsies might be able to. \r\n\r\nThe value yielded should be a namedtuple() instance, values ``.ucs(str), .is_sequence(bool), .capname(str), .params(tuple(str))``\r\n\r\nThis can be achieved by modifying the regex parse builders in blessed/sequences.py to include ``(?P<name>...)`` in the expressions compiled."}}