Skip to content

There is a discrepancy in how control characters (specifically \n) are handled when calling .width() on a char versus a &str. #87

@schwidom

Description

@schwidom

In version 0.2.2 :

use unicode_width::{UnicodeWidthChar, UnicodeWidthStr};

fn main() {
    let c = '\n';
    let s = "\n";

    println!("char width: {:?}", c.width()); // Returns None
    println!("str width:  {:?}", s.width()); // Returns 1
}

Is that a bug or a feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions