Skip to content

Commit

Permalink
Merge pull request #94 from alexander-beedie/utf8-condensed-preset
Browse files Browse the repository at this point in the history
New preset, `UTF8_FULL_CONDENSED`
  • Loading branch information
Nukesor committed Oct 18, 2022
2 parents dce08d6 + 09445e3 commit 224bbbb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/style/presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ pub const ASCII_MARKDOWN: &str = "|| |-||| ";
/// ```
pub const UTF8_FULL: &str = "││──╞═╪╡┆╌┼├┤┬┴┌┐└┘";

/// Default UTF8 style, but without spacing between rows.
///
/// ```text
/// ┌───────┬───────┐
/// │ Hello ┆ there │
/// ╞═══════╪═══════╡
/// │ a ┆ b │
/// │ c ┆ d │
/// └───────┴───────┘
/// ```
pub const UTF8_FULL_CONDENSED: &str = "││──╞═╪╡┆ ┬┴┌┐└┘";

/// Default UTF8 style, but without any borders.
///
/// ```text
Expand All @@ -95,7 +107,7 @@ pub const UTF8_FULL: &str = "││──╞═╪╡┆╌┼├┤┬┴┌┐
/// ```
pub const UTF8_NO_BORDERS: &str = " ═╪ ┆╌┼ ";

/// Just like the UTF8 FULL version, but without vertical/horizontal middle lines.
/// Just like the UTF8_FULL style, but without vertical/horizontal middle lines.
///
/// ```text
/// ┌───────────────┐
Expand Down
16 changes: 16 additions & 0 deletions tests/all/presets_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,22 @@ fn test_utf8_full() {
assert_eq!("\n".to_string() + &table.trim_fmt(), expected);
}

#[test]
fn test_utf8_condensed() {
let mut table = get_preset_table();
table.load_preset(UTF8_FULL_CONDENSED);
println!("{table}");
let expected = "
┌───────┬───────┐
│ Hello ┆ there │
╞═══════╪═══════╡
│ a ┆ b │
│ c ┆ d │
└───────┴───────┘";
println!("{expected}");
assert_eq!("\n".to_string() + &table.trim_fmt(), expected);
}

#[test]
fn test_utf8_no_borders() {
let mut table = get_preset_table();
Expand Down

0 comments on commit 224bbbb

Please sign in to comment.