Skip to content

Commit e332ef2

Browse files
committed
fix: test
1 parent e4458d5 commit e332ef2

File tree

5 files changed

+7
-14
lines changed

5 files changed

+7
-14
lines changed

Cargo.lock

Lines changed: 1 addition & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ futures = "0.3.28"
4444

4545
clap = { version = "4.4.3", features = ["derive", "wrap_help"] }
4646
colored = "2.0.4"
47-
term_size = "0.3.2"
47+
terminal_size = "0.2.6"
4848

4949
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

src/display/colorful.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use colored::Colorize;
1515
use std::fmt::Display;
1616
use std::ops::Not;
1717
use std::path::PathBuf;
18+
use terminal_size::terminal_size;
1819
use unicode_width::UnicodeWidthStr;
1920

2021
pub fn login(cfg_path: &Result<PathBuf>) {
@@ -90,7 +91,7 @@ pub fn list_ing(
9091
println!(" {} {}", "#".dimmed(), ing.id.to_string().dimmed());
9192
let content = if align {
9293
let user_name_width = ing.user_name.width_cjk();
93-
let (term_width, _) = term_size::dimensions().expect("Can not get terminal size");
94+
let term_width = terminal_size().expect("Can not get terminal size").0 .0 as usize;
9495
let left_width = term_width.saturating_sub(user_name_width + 3);
9596
fmt_content(&ing.content)
9697
.width_split(left_width)

src/display/normal.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use colored::Colorize;
1515
use std::fmt::Display;
1616
use std::ops::Not;
1717
use std::path::PathBuf;
18+
use terminal_size::terminal_size;
1819
use unicode_width::UnicodeWidthStr;
1920

2021
pub fn login(cfg_path: &Result<PathBuf>) {
@@ -90,7 +91,7 @@ pub fn list_ing(
9091
println!(" # {}", ing.id);
9192
let content = if align {
9293
let user_name_width = ing.user_name.width_cjk();
93-
let (term_width, _) = term_size::dimensions().expect("Can not get terminal size");
94+
let term_width = terminal_size().expect("Can not get terminal size").0 .0 as usize;
9495
let left_width = term_width.saturating_sub(user_name_width + 3);
9596
fmt_content(&ing.content)
9697
.width_split(left_width)

src/infra/str.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ fn test_width_split_head() {
6363

6464
#[test]
6565
fn test_width_split() {
66+
use crate::infra::option::IntoOption;
6667
let text = "测试test⭐测试test⭐";
6768
assert_eq!(text.width_split(0), None);
6869
assert_eq!(text.width_split(1), None);

0 commit comments

Comments
 (0)