{"action":"created","issue":{"url":"https://api.github.com/repos/stanch/reftree/issues/20","repository_url":"https://api.github.com/repos/stanch/reftree","labels_url":"https://api.github.com/repos/stanch/reftree/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/stanch/reftree/issues/20/comments","events_url":"https://api.github.com/repos/stanch/reftree/issues/20/events","html_url":"https://github.com/stanch/reftree/issues/20","id":331039144,"node_id":"MDU6SXNzdWUzMzEwMzkxNDQ=","number":20,"title":"How to add pointers to indices into array","user":{"login":"pathikrit","id":899219,"node_id":"MDQ6VXNlcjg5OTIxOQ==","avatar_url":"https://avatars2.githubusercontent.com/u/899219?v=4","gravatar_id":"","url":"https://api.github.com/users/pathikrit","html_url":"https://github.com/pathikrit","followers_url":"https://api.github.com/users/pathikrit/followers","following_url":"https://api.github.com/users/pathikrit/following{/other_user}","gists_url":"https://api.github.com/users/pathikrit/gists{/gist_id}","starred_url":"https://api.github.com/users/pathikrit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pathikrit/subscriptions","organizations_url":"https://api.github.com/users/pathikrit/orgs","repos_url":"https://api.github.com/users/pathikrit/repos","events_url":"https://api.github.com/users/pathikrit/events{/privacy}","received_events_url":"https://api.github.com/users/pathikrit/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-11T04:06:06Z","updated_at":"2018-06-11T10:33:37Z","closed_at":null,"author_association":"NONE","body":"I have the following image generated:\r\n![arraydeque](https://user-images.githubusercontent.com/899219/41212351-2a0a3a66-6d0b-11e8-915a-1b61e53fcbff.gif)\r\n\r\nThis is the code I am using:\r\n```scala\r\nimplicit def `ArrayDeque RefTree`: ToRefTree[mutable.ArrayDeque[Char]] = ToRefTree {ds =>\r\n    val array = ds.privateField[Array[AnyRef]](\"array\").map(c => Option(c).getOrElse('␀').asInstanceOf[Char])\r\n    val start = ds.privateField[Int](\"start\")\r\n    val end = ds.privateField[Int](\"end\")\r\n\r\n    val arrayRef = {\r\n      val arrayFields = array.zipWithIndex map { case (a, i) =>\r\n        val name = i match {\r\n          case `start` if start == end => s\"start=end=$i\"\r\n          case `start` => s\"start=$i\"\r\n          case `end` => s\"end=$i\"\r\n          case _ => i.toString\r\n        }\r\n        a.refTree.withHighlight(i == start || i == end).toField.withName(name)\r\n      }\r\n      RefTree.Ref(array, arrayFields).rename(s\"char[${array.length}]\")\r\n    }\r\n\r\n    RefTree.Ref(ds, Seq(\r\n      start.refTree.withHighlight(true).toField.withName(\"start\"),\r\n      end.refTree.withHighlight(true).toField.withName(\"end\"),\r\n      arrayRef.toField.withName(\"array\")\r\n    ) ++ ds.toArray.zipWithIndex.map({case (a, i) => a.refTree.toField.withName(i.toString)}))\r\n  }\r\n```\r\n\r\nBut, it would be nice to have `start` and `end` have arrows into the array. Is it possible?"},"comment":{"url":"https://api.github.com/repos/stanch/reftree/issues/comments/396198687","html_url":"https://github.com/stanch/reftree/issues/20#issuecomment-396198687","issue_url":"https://api.github.com/repos/stanch/reftree/issues/20","id":396198687,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjE5ODY4Nw==","user":{"login":"stanch","id":2670454,"node_id":"MDQ6VXNlcjI2NzA0NTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2670454?v=4","gravatar_id":"","url":"https://api.github.com/users/stanch","html_url":"https://github.com/stanch","followers_url":"https://api.github.com/users/stanch/followers","following_url":"https://api.github.com/users/stanch/following{/other_user}","gists_url":"https://api.github.com/users/stanch/gists{/gist_id}","starred_url":"https://api.github.com/users/stanch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stanch/subscriptions","organizations_url":"https://api.github.com/users/stanch/orgs","repos_url":"https://api.github.com/users/stanch/repos","events_url":"https://api.github.com/users/stanch/events{/privacy}","received_events_url":"https://api.github.com/users/stanch/received_events","type":"User","site_admin":false},"created_at":"2018-06-11T10:33:37Z","updated_at":"2018-06-11T10:33:37Z","author_association":"OWNER","body":"Nice animation! In theory, GraphViz supports pointing from fields to other fields, but reftree doesn’t expose that. I’m not sure what would be the best way to do it without making the existing functionality more complicated... But I am open to suggestions! :) In the meantime, some improvements could be using `↳3`, `6↲` or `↳5↲` (instead of `start=3`, `end=6`, `start=end=5` respectively); and highlighting the entire portion of the array that is active, instead of just the end markers."}}
{"actor":{"display_login":"stanch"}}