Skip to content

Commit 336ba30

Browse files
committed
file format
1 parent 05230d3 commit 336ba30

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/display.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ use rand::prelude::*;
77
use std::sync::Arc;
88
use std::sync::atomic::{AtomicBool, Ordering};
99
use std::time::Duration;
10-
use std::{thread, fs, io::{self, Write}};
10+
use std::{
11+
fs,
12+
io::{self, Write},
13+
thread,
14+
};
1115
use term_size;
1216
use textwrap::wrap;
1317
use unicode_width::UnicodeWidthStr;
@@ -460,7 +464,8 @@ pub fn render(runtime: &RuntimeConfig, cli: &crate::cli::Cli) {
460464
// Handle Ctrl+C gracefully
461465
ctrlc::set_handler(move || {
462466
r.store(false, Ordering::SeqCst);
463-
}).expect("Error setting Ctrl-C handler");
467+
})
468+
.expect("Error setting Ctrl-C handler");
464469

465470
// Hide cursor
466471
print!("\x1B[?25l");
@@ -476,19 +481,25 @@ pub fn render(runtime: &RuntimeConfig, cli: &crate::cli::Cli) {
476481
let mut vertical = 0;
477482
let mut horizontal = 0;
478483

479-
if runtime.border {
484+
if runtime.border {
480485
vertical = runtime.vertical_padding;
481486
horizontal = runtime.horizontal_padding;
482487
}
483488

484489
// estimate how many lines the box will take (content + borders + padding)
485490
let content_lines = {
486491
let mut count = jap_lines.len();
487-
if show_translation { count += 1; }
488-
if show_source { count += 1; }
492+
if show_translation {
493+
count += 1;
494+
}
495+
if show_source {
496+
count += 1;
497+
}
489498
// Add vertical padding and border lines
490499
count += vertical * 2;
491-
if runtime.border { count += 2; }
500+
if runtime.border {
501+
count += 2;
502+
}
492503
count
493504
};
494505

0 commit comments

Comments
 (0)