{"id":36844969,"url":"https://github.com/briansteffens/escapebox","last_synced_at":"2026-01-12T14:32:03.193Z","repository":{"id":57514124,"uuid":"83506718","full_name":"briansteffens/escapebox","owner":"briansteffens","description":"Detect custom escape sequences in termbox-go","archived":false,"fork":false,"pushed_at":"2017-03-15T04:04:49.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-15T08:13:15.003Z","etag":null,"topics":["escape","sequences","termbox","termbox-go","terminal"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/briansteffens.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-01T03:22:39.000Z","updated_at":"2017-04-05T02:45:42.000Z","dependencies_parsed_at":"2022-08-31T22:01:39.194Z","dependency_job_id":null,"html_url":"https://github.com/briansteffens/escapebox","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/briansteffens/escapebox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briansteffens%2Fescapebox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briansteffens%2Fescapebox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briansteffens%2Fescapebox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briansteffens%2Fescapebox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/briansteffens","download_url":"https://codeload.github.com/briansteffens/escapebox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briansteffens%2Fescapebox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28340400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["escape","sequences","termbox","termbox-go","terminal"],"created_at":"2026-01-12T14:32:03.086Z","updated_at":"2026-01-12T14:32:03.163Z","avatar_url":"https://github.com/briansteffens.png","language":"Go","readme":"escapebox\n=========\n\nThis is a hack around [termbox-go](https://github.com/nsf/termbox-go) which\nallows detection of custom escape sequences.\n\n# Example\n\nA working example is available here:\n[examples/shifttab.go](examples/shifttab.go)\n\n# Usage\n\nI tried to keep the API pretty similar to using termbox directly. The basic\nidea is:\n\n1. Initialize escapebox.\n2. Register any custom escape sequences you want detected.\n3. Poll events with escapebox.PollEvent() instead of termbox.PollEvent().\n4. Check the escapebox.Event.Seq field to see if a sequence was detected.\n5. Close escapebox to clean it up.\n\nTaking a closer look, here's how to download escapebox:\n\n```bash\ngo get https://github.com/briansteffens/escapebox\n```\n\nImport it into a go program:\n\n```go\nimport \"github.com/briansteffens/escapebox\"\n```\n\nIn a termbox application, here's how to initialize escapebox:\n\n```go\nescapebox.Init()\ndefer escapebox.Close()\n```\n\nFirst you'll probably want some way to tell your sequences apart:\n\n```go\nconst (\n\tSeqShiftTab = 1\n)\n```\n\nNow you can register your custom sequences. The following means that an escape\nkey followed in rapid succession (\u003c 1 ms) by two events with\ntermbox.Event.Chr = 91 and 90 will map to a SeqShiftTab:\n\n```go\nescapebox.Register(SeqShiftTab, 91, 90)\n```\n\nNow you can poll for events:\n\n```go\nev := escapebox.PollEvent()\n```\n\nThe escapebox.Event structure returned by escapebox.PollEvent() is identical to\nthe standard termbox.Event structure, except for one added field: an int called\nSeq. If Seq is set to SeqNone, then it's a standard event and all the usual\nfields like Ch and Key are set like normal. If Seq is not set to SeqNone, then\nit's a custom escape sequence matching one of the sequences you registered:\n\n```go\nif ev.Seq == SeqShiftTab {\n\t// The shift+tab sequence was detected\n} else if ev.Seq == SeqNone {\n\t// This is a regular event. Check Type, Ch, and Key to see what it is\n\t// as if it was a standard termbox event.\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriansteffens%2Fescapebox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbriansteffens%2Fescapebox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriansteffens%2Fescapebox/lists"}