Skip to content
Open
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
58 changes: 58 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ arrow = {version = "50.0.0", default-features = false, features = ["csv"]}
sorted-vec = "0.8.3"
arboard = { version = "3.3.2", features = ["wayland-data-control"], optional = true }
thiserror = "1.0.63"
unic-bidi = "0.9.0"

[target.'cfg(windows)'.dependencies]
crossterm = "0.27.0"
Expand Down
12 changes: 11 additions & 1 deletion src/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use std::time;

use crate::errors::CsvlensResult;

use unic_bidi::BidiInfo;

fn string_record_to_vec(record: &csv::StringRecord) -> Vec<String> {
let mut string_vec = Vec::new();
for field in record.iter() {
Expand Down Expand Up @@ -239,7 +241,15 @@ impl CsvLensReader {
let string_record = r?;
let mut fields = Vec::new();
for field in string_record.iter() {
fields.push(String::from(field));
if field.is_empty() {
fields.push(String::from(""));
continue;
}
let bidi_info = BidiInfo::new(field, None);
let para = &bidi_info.paragraphs[0];
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this handle the case where there are multiple paragraphs?

let line = para.range.clone();
let display = bidi_info.reorder_line(para, line);
fields.push(String::from(display));
}
let row = Row {
record_num: self.config.position_to_record_num(record_position)
Expand Down