8000 Fix ellipsis by alexhallam · Pull Request #61 · alexhallam/tv · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix ellipsis #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
0.0.14 (2021-09-29)
==================

* **Feature 1** Add package to snapcraft to increase accessibility.
* [BUG #55](https://github.com/alexhallam/tv/issues/55):
Fix panic on Unicode string truncation
* [BUG #40](https://github.com/alexhallam/tv/issues/30):
Remove trailing comma.
* [BUG #48](https://github.com/alexhallam/tv/issues/48):
Logicals 1/0 were mentioned in comments, but not implemented.
* [BUG #60](https://github.com/alexhallam/tv/issues/60):
Ellipsis then space, not space then ellipsis.

The rest of the updates had to do with README updates and spelling errors in code comments.

0.0.13 (2021-09-27)
==================
This version was made possible by the contributions of @Lireer! Thank You!
Expand Down
12 changes: 11 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "Unlicense/MIT"
name = "tidy-viewer"
readme = "README.md"
repository = "https://github.com/alexhallam/tv"
version = "0.0.13"
version = "0.0.14"

[package.metadata.deb]
assets = [
Expand Down
2 changes: 0 additions & 2 deletions data/d.csv

This file was deleted.

4 changes: 4 additions & 0 deletions data/ellipsis.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
long_text,double
jaywalker-swear-popcorn-opacity-nuttiness-roster,5.89
unspoiled-treachery-yearning-deputize-stimuli-coexist,2.34
conflict-yield-sulphate-grumpily-vagrantly-subsiding,7.89
6 changes: 6 additions & 0 deletions data/logical.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bool,TF
1,F
1,T
0,F
0,T

2 changes: 2 additions & 0 deletions data/unicode_pr55.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
aColumn,bColumn,cColumn,dColumn,eColumn,fColumn,gColumn
1,üÜğĞçÇşŞöÖ,üÜğĞçÇşŞöÖ üÜğĞçÇşŞöÖ,77,TR,77,77
12 changes: 7 additions & 5 deletions src/datatype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ pub fn is_logical(text: &str) -> bool {
// col_logical -l, T,F,TRUE,FALSE,True,False,true,false,t,f,1,0
lazy_static! {
static ref R: Regex =
Regex::new(r"^true$|^false$|^t$|^f$|TRUE$|^FALSE$|^T$|^F$|^True|^False").unwrap();
Regex::new(r"^true$|^false$|^t$|^f$|TRUE$|^FALSE$|^T$|^F$|^True|^False|^1$|^0$")
.unwrap();
}
//let r = Regex::new(rgex).unwrap();
R.is_match(text)
}

Expand Down Expand Up @@ -85,6 +85,8 @@ pub fn is_na_string_padded(text: &str) -> bool {
pub fn infer_type_from_string(text: &str) -> &'static str {
if is_time(text) {
"<tst>"
} else if is_logical(text) {
"<lgl>"
} else if is_integer(text) {
"<int>"
} else if is_date_time(text) {
Expand All @@ -93,8 +95,6 @@ pub fn infer_type_from_string(text: &str) -> &'static str {
"<tsd>"
} else if is_double(text) {
"<dbl>"
} else if is_logical(text) {
"<lgl>"
} else {
"<chr>"
}
Expand All @@ -111,7 +111,9 @@ pub fn trunc_strings(vec_col: &[&str], width: usize) -> Vec<String> {
let len = string.chars().count();
if len > width {
let (rv, _) = string.unicode_truncate(width - 1);
[rv.to_string(), ellipsis.to_string()].join(" ")
let spacer: &str = &" ";
let string_and_ellipses = [rv.to_string(), ellipsis.to_string()].join("");
[string_and_ellipses, spacer.to_string()].join("")
} else {
let add_space = width - len + 1;
let borrowed_string: &str = &" ".repeat(add_space);
Expand Down
0