Skip to content

Commit

Permalink
Rename crate to unicode-width-16
Browse files Browse the repository at this point in the history
  • Loading branch information
kchibisov authored and chrisduerr committed Oct 10, 2024
1 parent 218f672 commit c731d6c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 32 deletions.
11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
[package]

name = "unicode-width"
name = "unicode-width-16"
version = "0.2.0"
authors = [
"kwantam <kwantam@gmail.com>",
"Manish Goregaokar <manishsmail@gmail.com>",
"Christian Duerr <contact@christianduerr.com>",
"Kirill Chibisov <contact@kchibisov.com>",
]

homepage = "https://github.com/unicode-rs/unicode-width"
repository = "https://github.com/unicode-rs/unicode-width"
homepage = "https://github.com/alacritty/unicode-width-16"
repository = "https://github.com/alacritty/unicode-width-16"
license = "MIT OR Apache-2.0"
categories = [
"command-line-interface",
Expand Down
27 changes: 6 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# `unicode-width`
# `unicode-width-16`

[![Build status](https://github.com/unicode-rs/unicode-width/actions/workflows/rust.yml/badge.svg)](https://github.com/unicode-rs/unicode-width/actions/workflows/rust.yml)
[![crates.io version](https://img.shields.io/crates/v/unicode-width)](https://crates.io/crates/unicode-width)
[![Docs status](https://img.shields.io/docsrs/unicode-width)](https://docs.rs/unicode-width/)
**This crate is a fork** of https://github.com/unicode-rs/unicode-width with
Unicode 16 support and removed `normalization`.

Determine displayed width of `char` and `str` types according to [Unicode Standard Annex #11][UAX11]
and other portions of the Unicode standard.
Expand All @@ -12,7 +11,7 @@ This crate is `#![no_std]`.
[UAX11]: http://www.unicode.org/reports/tr11/

```rust
use unicode_width::UnicodeWidthStr;
use unicode_width_16::UnicodeWidthStr;

fn main() {
let teststr = "Hello, world!";
Expand All @@ -30,8 +29,7 @@ zero-width joiner and a microscope emoji. Such [emoji ZWJ sequences](https://www
are considered to have the sum of the widths of their constituent parts:

```rust
extern crate unicode_width;
use unicode_width::UnicodeWidthStr;
use unicode_width_16::UnicodeWidthStr;

fn main() {
assert_eq!("👩".width(), 2); // Woman
Expand All @@ -52,18 +50,5 @@ to your `Cargo.toml`:

```toml
[dependencies]
unicode-width = "0.2"
unicode-width-16 = "0.2"
```


## Changelog


### 0.2.0

- Treat `\n` as width 1 (#60)
- Treat ambiguous `Modifier_Letter`s as narrow (#63)
- Support `Grapheme_Cluster_Break=Prepend` (#62)
- Support lots of ligatures (#53)

Note: If you are using `unicode-width` for linebreaking, the change treating `\n` as width 1 _may cause behavior changes_. It is recommended that in such cases you feed already-line segmented text to `unicode-width`. In other words, please apply higher level control character based line breaking protocols before feeding text to `unicode-width`. Relying on any character producing a stable width in this crate is likely the sign of a bug.
2 changes: 1 addition & 1 deletion benches/benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::iter;

use test::Bencher;

use unicode_width::{UnicodeWidthChar, UnicodeWidthStr};
use unicode_width_16::{UnicodeWidthChar, UnicodeWidthStr};

#[bench]
fn cargo(b: &mut Bencher) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ def emit_module(
module.write(
f"""
/// The version of [Unicode](http://www.unicode.org/)
/// that this version of unicode-width is based on.
/// that this version of unicode-width-16 is based on.
pub const UNICODE_VERSION: (u8, u8, u8) = {unicode_version};
"""
)
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! This crate is `#![no_std]`.
//!
//! ```rust
//! use unicode_width::UnicodeWidthStr;
//! use unicode_width_16::UnicodeWidthStr;
//!
//! let teststr = "Hello, world!";
//! let width = UnicodeWidthStr::width(teststr);
Expand Down
2 changes: 1 addition & 1 deletion src/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// NOTE: The following code was generated by "scripts/unicode.py", do not edit directly

/// The version of [Unicode](http://www.unicode.org/)
/// that this version of unicode-width is based on.
/// that this version of unicode-width-16 is based on.
pub const UNICODE_VERSION: (u8, u8, u8) = (16, 0, 0);

pub mod charwidth {
Expand Down
2 changes: 1 addition & 1 deletion tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::{
io::{BufRead, BufReader},
};

use unicode_width::{UnicodeWidthChar, UnicodeWidthStr};
use unicode_width_16::{UnicodeWidthChar, UnicodeWidthStr};

#[test]
fn test_str() {
Expand Down

0 comments on commit c731d6c

Please sign in to comment.