{"action":"created","issue":{"url":"https://api.github.com/repos/pqwy/notty/issues/24","repository_url":"https://api.github.com/repos/pqwy/notty","labels_url":"https://api.github.com/repos/pqwy/notty/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/pqwy/notty/issues/24/comments","events_url":"https://api.github.com/repos/pqwy/notty/issues/24/events","html_url":"https://github.com/pqwy/notty/issues/24","id":326722526,"node_id":"MDU6SXNzdWUzMjY3MjI1MjY=","number":24,"title":"Possible extensions to the image combinators","user":{"login":"yminsky","id":715302,"node_id":"MDQ6VXNlcjcxNTMwMg==","avatar_url":"https://avatars0.githubusercontent.com/u/715302?v=4","gravatar_id":"","url":"https://api.github.com/users/yminsky","html_url":"https://github.com/yminsky","followers_url":"https://api.github.com/users/yminsky/followers","following_url":"https://api.github.com/users/yminsky/following{/other_user}","gists_url":"https://api.github.com/users/yminsky/gists{/gist_id}","starred_url":"https://api.github.com/users/yminsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yminsky/subscriptions","organizations_url":"https://api.github.com/users/yminsky/orgs","repos_url":"https://api.github.com/users/yminsky/repos","events_url":"https://api.github.com/users/yminsky/events{/privacy}","received_events_url":"https://api.github.com/users/yminsky/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-26T08:53:22Z","updated_at":"2018-08-15T17:04:46Z","closed_at":null,"author_association":"NONE","body":"One issue I see with the current image combinators is that the ability to overlay them seems limited. In particular, it's often natural to want to overlay some property over an existing image. For example, it would be nice to highlight a range of text by setting the background color attribute on some range of an existing image.\r\n\r\nThe current combinators offer no way of doing this cleanly, as far as I understand. To make it work, you basically need to get the correct attributes in when constructing the original image.\r\n\r\n Would there be any interesting in adding some calls that would allow this kind of thing by operating more directly on images?"},"comment":{"url":"https://api.github.com/repos/pqwy/notty/issues/comments/413265048","html_url":"https://github.com/pqwy/notty/issues/24#issuecomment-413265048","issue_url":"https://api.github.com/repos/pqwy/notty/issues/24","id":413265048,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMzI2NTA0OA==","user":{"login":"pqwy","id":325535,"node_id":"MDQ6VXNlcjMyNTUzNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/325535?v=4","gravatar_id":"","url":"https://api.github.com/users/pqwy","html_url":"https://github.com/pqwy","followers_url":"https://api.github.com/users/pqwy/followers","following_url":"https://api.github.com/users/pqwy/following{/other_user}","gists_url":"https://api.github.com/users/pqwy/gists{/gist_id}","starred_url":"https://api.github.com/users/pqwy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pqwy/subscriptions","organizations_url":"https://api.github.com/users/pqwy/orgs","repos_url":"https://api.github.com/users/pqwy/repos","events_url":"https://api.github.com/users/pqwy/events{/privacy}","received_events_url":"https://api.github.com/users/pqwy/received_events","type":"User","site_admin":false},"created_at":"2018-08-15T17:04:46Z","updated_at":"2018-08-15T17:04:46Z","author_association":"OWNER","body":"So... if you can set attributes on a region of the `image`, what falls out naturally is simply another image constructor `screen : A.t -> int -> int -> image` that produces a `w * h` rectangle with a particular attribute.\r\n\r\nThis rectangle renders like [`void`](http://pqwy.github.io/notty/doc/Notty.I.html#VALvoid), but when [overlaid](http://pqwy.github.io/notty/doc/Notty.I.html#VAL(%3C/%3E)) over another `image`, it changes the attributes of the cells below.\r\n\r\nIf it simply replaces what's below, that's too coarse. You couldn't make `[####===]` with different foregrounds, and then set the background in a single operation. It would force the foreground too.\r\n\r\nSo you need to [compose](http://pqwy.github.io/notty/doc/Notty.A.html#VAL(++)) the attributes per-cell. You also get\r\n```\r\nscreen a1 w h </> screen a2 w n = screen (a2 ++ a1) w h\r\n```\r\nwhich is nice.\r\n\r\nThen, both because it's impossible to recolour cells, and because this gets redundant, you remove attributes from the existing image constructors (and add `attr: attr -> image -> image` to compensate). Freshly constructed images all have [no attributes](http://pqwy.github.io/notty/doc/Notty.A.html#VALempty).\r\n\r\nSuddenly, explaining how this all fits together becomes much more involved. That, and when constructing images, you have to closely keep track of which regions have which attributes _set_ and which are _unset_, as this affects image composition; say you create two distinct images, A and B, using `screen` to style A. If you do `A </> B`, wherever there are holes in A, there are visible cells of B with their attributes combined with A's.\r\n\r\nAn alternative is to introduce two distinct overlay operators, with only one combining the attributes.\r\n\r\nAnd someone will surely demand to be able to remove attributes -- now you have negative attributes.\r\n\r\nThis can all be made to work, but it sounds tricky to use. That's what I mean when I say the semantics isn't quite clear."}}
{"actor":{"display_login":"pqwy"}}