Skip to content

Commit 44e47eb

Browse files
committed
Don't output unnecessary newline in supported() methods
1 parent 8dfca02 commit 44e47eb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Diff for: src/onefetch/image_backends/kitty.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use {
66
POLLIN, STDIN_FILENO, STDOUT_FILENO, TCSANOW, TIOCGWINSZ,
77
},
88
std::env,
9+
std::io::{stdout, Write},
910
std::time::Instant,
1011
};
1112

@@ -38,7 +39,8 @@ impl KittyBackend {
3839
test_image.extend(std::iter::repeat([255, 0, 0, 255].iter()).take(32 * 32).flatten());
3940

4041
// print the test image with the action set to query
41-
println!("\x1B_Gi=1,f=32,s=32,v=32,a=q;{}\x1B\\", base64::encode(&test_image));
42+
print!("\x1B_Gi=1,f=32,s=32,v=32,a=q;{}\x1B\\", base64::encode(&test_image));
43+
stdout().flush().unwrap();
4244

4345
let start_time = Instant::now();
4446
let mut stdin_pollfd = pollfd { fd: STDIN_FILENO, events: POLLIN, revents: 0 };

Diff for: src/onefetch/image_backends/sixel.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use {
99
c_void, ioctl, poll, pollfd, read, tcgetattr, tcsetattr, termios, winsize, ECHO, ICANON,
1010
POLLIN, STDIN_FILENO, STDOUT_FILENO, TCSANOW, TIOCGWINSZ,
1111
},
12+
std::io::{stdout, Write},
1213
std::time::Instant,
1314
};
1415

@@ -33,7 +34,8 @@ impl SixelBackend {
3334
};
3435

3536
// ask for the primary device attribute string
36-
println!("\x1B[c");
37+
print!("\x1B[c");
38+
stdout().flush().unwrap();
3739

3840
let start_time = Instant::now();
3941
let mut stdin_pollfd = pollfd { fd: STDIN_FILENO, events: POLLIN, revents: 0 };

0 commit comments

Comments
 (0)