From 9776a252eea459495d48aaa95bf4543bebd0cf1a Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Fri, 21 May 2021 08:04:48 -0500 Subject: [PATCH] add addition characters that can be hard to work with in nushell (#3457) --- crates/nu-command/src/commands/char_.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/nu-command/src/commands/char_.rs b/crates/nu-command/src/commands/char_.rs index 97ff427c2..5c03737ad 100644 --- a/crates/nu-command/src/commands/char_.rs +++ b/crates/nu-command/src/commands/char_.rs @@ -135,9 +135,19 @@ fn string_to_unicode_char(s: &str, t: &Tag) -> Result { fn str_to_character(s: &str) -> Option { match s { + // These are some regular characters that either can't used or + // it's just easier to use them like this. "newline" | "enter" | "nl" => Some("\n".into()), "tab" => Some("\t".into()), "sp" | "space" => Some(" ".into()), + "pipe" => Some('|'.to_string()), + "left_brace" | "lbrace" => Some('{'.to_string()), + "right_brace" | "rbrace" => Some('}'.to_string()), + "left_paren" | "lparen" => Some('('.to_string()), + "right_paren" | "rparen" => Some(')'.to_string()), + "left_bracket" | "lbracket" => Some('['.to_string()), + "right_bracket" | "rbracket" => Some(']'.to_string()), + // Unicode names came from https://www.compart.com/en/unicode // Private Use Area (U+E000-U+F8FF) // Unicode can't be mixed with Ansi or it will break width calculation