{"id":28799250,"url":"https://github.com/janlelis/wcswidth-ruby","last_synced_at":"2025-08-24T10:17:48.289Z","repository":{"id":56897877,"uuid":"52893418","full_name":"janlelis/wcswidth-ruby","owner":"janlelis","description":"FFI bindings to libc's wcswidth() to determine the actual display width of strings","archived":false,"fork":false,"pushed_at":"2021-11-06T14:18:32.000Z","size":9,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-01T11:58:16.401Z","etag":null,"topics":["ffi-bindings","ruby","unicode"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/janlelis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-01T16:50:12.000Z","updated_at":"2021-11-06T14:18:34.000Z","dependencies_parsed_at":"2022-08-21T02:20:25.242Z","dependency_job_id":null,"html_url":"https://github.com/janlelis/wcswidth-ruby","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/janlelis/wcswidth-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Fwcswidth-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Fwcswidth-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Fwcswidth-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Fwcswidth-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janlelis","download_url":"https://codeload.github.com/janlelis/wcswidth-ruby/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Fwcswidth-ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271843999,"owners_count":24832666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ffi-bindings","ruby","unicode"],"created_at":"2025-06-18T06:04:51.288Z","updated_at":"2025-08-24T10:17:48.277Z","avatar_url":"https://github.com/janlelis.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wcswidth [![[version]](https://badge.fury.io/rb/wcswidth.svg)](https://badge.fury.io/rb/wcswidth) [![[ci]](https://github.com/janlelis/wcswidth/workflows/Test/badge.svg)](https://github.com/janlelis/wcswidth/actions?query=workflow%3ATest)\n\nDetermine terminal display width (columns) of Ruby strings via [FFI bindings](https://github.com/ffi/ffi/wiki) to libc's [wcswidth()](http://man7.org/linux/man-pages/man3/wcswidth.3.html) function.\n\nSee [unicode/display_width](https://github.com/janlelis/unicode-display_width) for a Ruby-only unicode data based approach.\n\n## Usage\n\n```ruby\nrequire 'wcswidth/kernel_method'\n\n# full width chars\nwcswidth(\"！\") # =\u003e 2\nwcswidth(\"一\") # =\u003e 2\n\n# single width chars\nwcswidth(\"A\") # =\u003e 1\nwcswidth(\"·\") # =\u003e 1\n\n# zero width chars\nwcswidth(\"ֿ\") # =\u003e 0\nwcswidth(\"\\0\") # =\u003e 0\n\n# control chars\nwcswidth(\"\\x01\") # =\u003e -1\nwcswidth(\"\\n\") # =\u003e -1\n```\n\nWithout opting in for `wcswidth/kernel_method` it is `Wcswidth.of(\"string\")`\n\n## MIT License\n\nCopyright (C) 2016 Jan Lelis \u003chttps://janlelis.com\u003e. Released under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanlelis%2Fwcswidth-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanlelis%2Fwcswidth-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanlelis%2Fwcswidth-ruby/lists"}