{"action":"created","comment":{"url":"https://api.github.com/repos/sharkdp/bat/pulls/comments/186339128","pull_request_review_id":117896515,"id":186339128,"diff_hunk":"@@ -0,0 +1,145 @@\n+use ansi_term::Style;\n+use console::Term;\n+use errors::*;\n+use std::io::Write;\n+use syntect::highlighting;\n+use terminal::as_terminal_escaped;\n+use {Colors, LineChange, LineChanges, Options, OptionsStyle};\n+\n+const PANEL_WIDTH: usize = 7;\n+\n+pub struct Printer<'a> {\n+    handle: &'a mut Write,\n+    colors: Colors,\n+    term_width: usize,\n+    options: &'a Options<'a>,","path":"src/printer.rs","position":15,"original_position":15,"commit_id":"623499368b728591ef3fc332423fc6b06a29208a","original_commit_id":"623499368b728591ef3fc332423fc6b06a29208a","user":{"login":"BrainMaestro","id":1738373,"avatar_url":"https://avatars3.githubusercontent.com/u/1738373?v=4","gravatar_id":"","url":"https://api.github.com/users/BrainMaestro","html_url":"https://github.com/BrainMaestro","followers_url":"https://api.github.com/users/BrainMaestro/followers","following_url":"https://api.github.com/users/BrainMaestro/following{/other_user}","gists_url":"https://api.github.com/users/BrainMaestro/gists{/gist_id}","starred_url":"https://api.github.com/users/BrainMaestro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrainMaestro/subscriptions","organizations_url":"https://api.github.com/users/BrainMaestro/orgs","repos_url":"https://api.github.com/users/BrainMaestro/repos","events_url":"https://api.github.com/users/BrainMaestro/events{/privacy}","received_events_url":"https://api.github.com/users/BrainMaestro/received_events","type":"User","site_admin":false},"body":"I thought about that, but we already need 3 of the options in there, and it's likely to grow as well. So, this seemed easier","created_at":"2018-05-07T06:49:22Z","updated_at":"2018-05-07T06:49:22Z","html_url":"https://github.com/sharkdp/bat/pull/75#discussion_r186339128","pull_request_url":"https://api.github.com/repos/sharkdp/bat/pulls/75","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/sharkdp/bat/pulls/comments/186339128"},"html":{"href":"https://github.com/sharkdp/bat/pull/75#discussion_r186339128"},"pull_request":{"href":"https://api.github.com/repos/sharkdp/bat/pulls/75"}},"in_reply_to_id":186338210},"pull_request":{"url":"https://api.github.com/repos/sharkdp/bat/pulls/75","id":186233574,"html_url":"https://github.com/sharkdp/bat/pull/75","diff_url":"https://github.com/sharkdp/bat/pull/75.diff","patch_url":"https://github.com/sharkdp/bat/pull/75.patch","issue_url":"https://api.github.com/repos/sharkdp/bat/issues/75","number":75,"state":"open","locked":false,"title":"Add printer","user":{"login":"BrainMaestro","id":1738373,"avatar_url":"https://avatars3.githubusercontent.com/u/1738373?v=4","gravatar_id":"","url":"https://api.github.com/users/BrainMaestro","html_url":"https://github.com/BrainMaestro","followers_url":"https://api.github.com/users/BrainMaestro/followers","following_url":"https://api.github.com/users/BrainMaestro/following{/other_user}","gists_url":"https://api.github.com/users/BrainMaestro/gists{/gist_id}","starred_url":"https://api.github.com/users/BrainMaestro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrainMaestro/subscriptions","organizations_url":"https://api.github.com/users/BrainMaestro/orgs","repos_url":"https://api.github.com/users/BrainMaestro/repos","events_url":"https://api.github.com/users/BrainMaestro/events{/privacy}","received_events_url":"https://api.github.com/users/BrainMaestro/received_events","type":"User","site_admin":false},"body":"This adds a separate struct that handles printing of the different\r\ntokens.\r\n\r\nI think this makes it easier to control the style without making the code too noisy. Just a simple guard check at the top of the relevant function before early exiting. I got it to the same state as master now, but the new proposed style features in #74 would be easier to understand. One caveat of this style is more allocations. Sorry about the huge code dump. Since we didn't discuss this beforehand, it's fine to close if you want to follow a different path.\r\n\r\n/cc: @sharkdp @pitkley","created_at":"2018-05-06T23:59:56Z","updated_at":"2018-05-07T06:49:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d2a7f705944427e3007ad2c5d7fe96ad7fec4429","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sharkdp/bat/pulls/75/commits","review_comments_url":"https://api.github.com/repos/sharkdp/bat/pulls/75/comments","review_comment_url":"https://api.github.com/repos/sharkdp/bat/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sharkdp/bat/issues/75/comments","statuses_url":"https://api.github.com/repos/sharkdp/bat/statuses/623499368b728591ef3fc332423fc6b06a29208a","head":{"label":"BrainMaestro:add-printer","ref":"add-printer","sha":"623499368b728591ef3fc332423fc6b06a29208a","user":{"login":"BrainMaestro","id":1738373,"avatar_url":"https://avatars3.githubusercontent.com/u/1738373?v=4","gravatar_id":"","url":"https://api.github.com/users/BrainMaestro","html_url":"https://github.com/BrainMaestro","followers_url":"https://api.github.com/users/BrainMaestro/followers","following_url":"https://api.github.com/users/BrainMaestro/following{/other_user}","gists_url":"https://api.github.com/users/BrainMaestro/gists{/gist_id}","starred_url":"https://api.github.com/users/BrainMaestro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrainMaestro/subscriptions","organizations_url":"https://api.github.com/users/BrainMaestro/orgs","repos_url":"https://api.github.com/users/BrainMaestro/repos","events_url":"https://api.github.com/users/BrainMaestro/events{/privacy}","received_events_url":"https://api.github.com/users/BrainMaestro/received_events","type":"User","site_admin":false},"repo":{"id":131814295,"name":"bat","full_name":"BrainMaestro/bat","owner":{"login":"BrainMaestro","id":1738373,"avatar_url":"https://avatars3.githubusercontent.com/u/1738373?v=4","gravatar_id":"","url":"https://api.github.com/users/BrainMaestro","html_url":"https://github.com/BrainMaestro","followers_url":"https://api.github.com/users/BrainMaestro/followers","following_url":"https://api.github.com/users/BrainMaestro/following{/other_user}","gists_url":"https://api.github.com/users/BrainMaestro/gists{/gist_id}","starred_url":"https://api.github.com/users/BrainMaestro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrainMaestro/subscriptions","organizations_url":"https://api.github.com/users/BrainMaestro/orgs","repos_url":"https://api.github.com/users/BrainMaestro/repos","events_url":"https://api.github.com/users/BrainMaestro/events{/privacy}","received_events_url":"https://api.github.com/users/BrainMaestro/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BrainMaestro/bat","description":"A cat(1) clone with wings.","fork":true,"url":"https://api.github.com/repos/BrainMaestro/bat","forks_url":"https://api.github.com/repos/BrainMaestro/bat/forks","keys_url":"https://api.github.com/repos/BrainMaestro/bat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BrainMaestro/bat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BrainMaestro/bat/teams","hooks_url":"https://api.github.com/repos/BrainMaestro/bat/hooks","issue_events_url":"https://api.github.com/repos/BrainMaestro/bat/issues/events{/number}","events_url":"https://api.github.com/repos/BrainMaestro/bat/events","assignees_url":"https://api.github.com/repos/BrainMaestro/bat/assignees{/user}","branches_url":"https://api.github.com/repos/BrainMaestro/bat/branches{/branch}","tags_url":"https://api.github.com/repos/BrainMaestro/bat/tags","blobs_url":"https://api.github.com/repos/BrainMaestro/bat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BrainMaestro/bat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BrainMaestro/bat/git/refs{/sha}","trees_url":"https://api.github.com/repos/BrainMaestro/bat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BrainMaestro/bat/statuses/{sha}","languages_url":"https://api.github.com/repos/BrainMaestro/bat/languages","stargazers_url":"https://api.github.com/repos/BrainMaestro/bat/stargazers","contributors_url":"https://api.github.com/repos/BrainMaestro/bat/contributors","subscribers_url":"https://api.github.com/repos/BrainMaestro/bat/subscribers","subscription_url":"https://api.github.com/repos/BrainMaestro/bat/subscription","commits_url":"https://api.github.com/repos/BrainMaestro/bat/commits{/sha}","git_commits_url":"https://api.github.com/repos/BrainMaestro/bat/git/commits{/sha}","comments_url":"https://api.github.com/repos/BrainMaestro/bat/comments{/number}","issue_comment_url":"https://api.github.com/repos/BrainMaestro/bat/issues/comments{/number}","contents_url":"https://api.github.com/repos/BrainMaestro/bat/contents/{+path}","compare_url":"https://api.github.com/repos/BrainMaestro/bat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BrainMaestro/bat/merges","archive_url":"https://api.github.com/repos/BrainMaestro/bat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BrainMaestro/bat/downloads","issues_url":"https://api.github.com/repos/BrainMaestro/bat/issues{/number}","pulls_url":"https://api.github.com/repos/BrainMaestro/bat/pulls{/number}","milestones_url":"https://api.github.com/repos/BrainMaestro/bat/milestones{/number}","notifications_url":"https://api.github.com/repos/BrainMaestro/bat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BrainMaestro/bat/labels{/name}","releases_url":"https://api.github.com/repos/BrainMaestro/bat/releases{/id}","deployments_url":"https://api.github.com/repos/BrainMaestro/bat/deployments","created_at":"2018-05-02T07:27:53Z","updated_at":"2018-05-06T18:09:52Z","pushed_at":"2018-05-07T02:01:41Z","git_url":"git://github.com/BrainMaestro/bat.git","ssh_url":"git@github.com:BrainMaestro/bat.git","clone_url":"https://github.com/BrainMaestro/bat.git","svn_url":"https://github.com/BrainMaestro/bat","homepage":"","size":1267,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sharkdp:master","ref":"master","sha":"b625d07c3401237a0e02d2947106e861179654e3","user":{"login":"sharkdp","id":4209276,"avatar_url":"https://avatars2.githubusercontent.com/u/4209276?v=4","gravatar_id":"","url":"https://api.github.com/users/sharkdp","html_url":"https://github.com/sharkdp","followers_url":"https://api.github.com/users/sharkdp/followers","following_url":"https://api.github.com/users/sharkdp/following{/other_user}","gists_url":"https://api.github.com/users/sharkdp/gists{/gist_id}","starred_url":"https://api.github.com/users/sharkdp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharkdp/subscriptions","organizations_url":"https://api.github.com/users/sharkdp/orgs","repos_url":"https://api.github.com/users/sharkdp/repos","events_url":"https://api.github.com/users/sharkdp/events{/privacy}","received_events_url":"https://api.github.com/users/sharkdp/received_events","type":"User","site_admin":false},"repo":{"id":130464961,"name":"bat","full_name":"sharkdp/bat","owner":{"login":"sharkdp","id":4209276,"avatar_url":"https://avatars2.githubusercontent.com/u/4209276?v=4","gravatar_id":"","url":"https://api.github.com/users/sharkdp","html_url":"https://github.com/sharkdp","followers_url":"https://api.github.com/users/sharkdp/followers","following_url":"https://api.github.com/users/sharkdp/following{/other_user}","gists_url":"https://api.github.com/users/sharkdp/gists{/gist_id}","starred_url":"https://api.github.com/users/sharkdp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharkdp/subscriptions","organizations_url":"https://api.github.com/users/sharkdp/orgs","repos_url":"https://api.github.com/users/sharkdp/repos","events_url":"https://api.github.com/users/sharkdp/events{/privacy}","received_events_url":"https://api.github.com/users/sharkdp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sharkdp/bat","description":"A cat(1) clone with wings.","fork":false,"url":"https://api.github.com/repos/sharkdp/bat","forks_url":"https://api.github.com/repos/sharkdp/bat/forks","keys_url":"https://api.github.com/repos/sharkdp/bat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sharkdp/bat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sharkdp/bat/teams","hooks_url":"https://api.github.com/repos/sharkdp/bat/hooks","issue_events_url":"https://api.github.com/repos/sharkdp/bat/issues/events{/number}","events_url":"https://api.github.com/repos/sharkdp/bat/events","assignees_url":"https://api.github.com/repos/sharkdp/bat/assignees{/user}","branches_url":"https://api.github.com/repos/sharkdp/bat/branches{/branch}","tags_url":"https://api.github.com/repos/sharkdp/bat/tags","blobs_url":"https://api.github.com/repos/sharkdp/bat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sharkdp/bat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sharkdp/bat/git/refs{/sha}","trees_url":"https://api.github.com/repos/sharkdp/bat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sharkdp/bat/statuses/{sha}","languages_url":"https://api.github.com/repos/sharkdp/bat/languages","stargazers_url":"https://api.github.com/repos/sharkdp/bat/stargazers","contributors_url":"https://api.github.com/repos/sharkdp/bat/contributors","subscribers_url":"https://api.github.com/repos/sharkdp/bat/subscribers","subscription_url":"https://api.github.com/repos/sharkdp/bat/subscription","commits_url":"https://api.github.com/repos/sharkdp/bat/commits{/sha}","git_commits_url":"https://api.github.com/repos/sharkdp/bat/git/commits{/sha}","comments_url":"https://api.github.com/repos/sharkdp/bat/comments{/number}","issue_comment_url":"https://api.github.com/repos/sharkdp/bat/issues/comments{/number}","contents_url":"https://api.github.com/repos/sharkdp/bat/contents/{+path}","compare_url":"https://api.github.com/repos/sharkdp/bat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sharkdp/bat/merges","archive_url":"https://api.github.com/repos/sharkdp/bat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sharkdp/bat/downloads","issues_url":"https://api.github.com/repos/sharkdp/bat/issues{/number}","pulls_url":"https://api.github.com/repos/sharkdp/bat/pulls{/number}","milestones_url":"https://api.github.com/repos/sharkdp/bat/milestones{/number}","notifications_url":"https://api.github.com/repos/sharkdp/bat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sharkdp/bat/labels{/name}","releases_url":"https://api.github.com/repos/sharkdp/bat/releases{/id}","deployments_url":"https://api.github.com/repos/sharkdp/bat/deployments","created_at":"2018-04-21T10:52:23Z","updated_at":"2018-05-07T06:46:23Z","pushed_at":"2018-05-07T02:01:42Z","git_url":"git://github.com/sharkdp/bat.git","ssh_url":"git@github.com:sharkdp/bat.git","clone_url":"https://github.com/sharkdp/bat.git","svn_url":"https://github.com/sharkdp/bat","homepage":"","size":1266,"stargazers_count":1442,"watchers_count":1442,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"archived":false,"open_issues_count":25,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":17,"open_issues":25,"watchers":1442,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sharkdp/bat/pulls/75"},"html":{"href":"https://github.com/sharkdp/bat/pull/75"},"issue":{"href":"https://api.github.com/repos/sharkdp/bat/issues/75"},"comments":{"href":"https://api.github.com/repos/sharkdp/bat/issues/75/comments"},"review_comments":{"href":"https://api.github.com/repos/sharkdp/bat/pulls/75/comments"},"review_comment":{"href":"https://api.github.com/repos/sharkdp/bat/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sharkdp/bat/pulls/75/commits"},"statuses":{"href":"https://api.github.com/repos/sharkdp/bat/statuses/623499368b728591ef3fc332423fc6b06a29208a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"BrainMaestro"}}