Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
This commit is contained in:
Maxim Zhiburt 2022-12-05 02:47:46 +03:00 committed by GitHub
parent 12deff5d1b
commit 41178dff90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 18 deletions

View File

@ -912,8 +912,6 @@ fn convert_to_table2<'a>(
}
for (row, item) in input.clone().into_iter().enumerate() {
let row = if with_header { row + 1 } else { row };
if let Some(ctrlc) = &ctrlc {
if ctrlc.load(Ordering::SeqCst) {
return Ok(None);
@ -935,6 +933,8 @@ fn convert_to_table2<'a>(
column_width = max(column_width, width);
let value = NuTable::create_cell(value.0, value.1);
let row = if with_header { row + 1 } else { row };
data[row].push(value);
}

View File

@ -31,8 +31,8 @@ fn table_expand_0() {
"╭───┬───┬───┬───────────╮\
# a b c \
\
1 1 2 3 \
2 4 5 \
0 1 2 3 \
1 4 5 \
0 1 \
1 2 \
2 3 \
@ -53,8 +53,8 @@ fn table_expand_exeed_overlap_0() {
"╭───┬────────────────────────┬───┬───────────╮\
# a b c \
\
1 xxxxxxxxxxxxxxxxxxxxxx 2 3 \
2 4 5 \
0 xxxxxxxxxxxxxxxxxxxxxx 2 3 \
1 4 5 \
0 1 \
1 2 \
2 3 \
@ -73,8 +73,8 @@ fn table_expand_exeed_overlap_0() {
"╭──────┬───────────────────────────────────────────────────┬─────┬─────────────╮\
# a b c \
\
1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2 3 \
2 4 5 \
0 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2 3 \
1 4 5 \
0 1 \
1 2 \
2 3 \
@ -91,8 +91,8 @@ fn table_expand_deep_0() {
"╭───┬───┬───┬────────────────────────╮\
# a b c \
\
1 1 2 3 \
2 4 5 \
0 1 2 3 \
1 4 5 \
0 1 \
1 2 \
2 [list 3 items] \
@ -109,8 +109,8 @@ fn table_expand_deep_1() {
"╭───┬───┬───┬────────────────╮\
# a b c \
\
1 1 2 3 \
2 4 5 [list 3 items] \
0 1 2 3 \
1 4 5 [list 3 items] \
"
);
}
@ -123,8 +123,8 @@ fn table_expand_flatten_0() {
"╭───┬───┬───┬───────────────╮\
# a b c \
\
1 1 2 3 \
2 4 5 \
0 1 2 3 \
1 4 5 \
0 1 \
1 2 \
2 1 1 1 \
@ -143,8 +143,8 @@ fn table_expand_flatten_1() {
"╭───┬───┬───┬───────────────╮\
# a b c \
\
1 1 2 3 \
2 4 5 \
0 1 2 3 \
1 4 5 \
0 1 \
1 2 \
2 1,1,1 \
@ -164,8 +164,8 @@ fn table_expand_flatten_and_deep_1() {
"╭───┬───┬───┬────────────────────────────────╮\
# a b c \
\
1 1 2 3 \
2 4 5 \
0 1 2 3 \
1 4 5 \
0 1 \
1 2 \
2 \