Skip to content

Commit

Permalink
Merge pull request #311 from yoichi/remove-unnecessary-newline
Browse files Browse the repository at this point in the history
Don't output unnecessary newline in supported() methods
  • Loading branch information
o2sh authored Nov 6, 2020
2 parents c94676c + 44e47eb commit 25babe8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/onefetch/image_backends/kitty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use {
POLLIN, STDIN_FILENO, STDOUT_FILENO, TCSANOW, TIOCGWINSZ,
},
std::env,
std::io::{stdout, Write},
std::time::Instant,
};

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

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

let start_time = Instant::now();
let mut stdin_pollfd = pollfd { fd: STDIN_FILENO, events: POLLIN, revents: 0 };
Expand Down
4 changes: 3 additions & 1 deletion src/onefetch/image_backends/sixel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use {
c_void, ioctl, poll, pollfd, read, tcgetattr, tcsetattr, termios, winsize, ECHO, ICANON,
POLLIN, STDIN_FILENO, STDOUT_FILENO, TCSANOW, TIOCGWINSZ,
},
std::io::{stdout, Write},
std::time::Instant,
};

Expand All @@ -33,7 +34,8 @@ impl SixelBackend {
};

// ask for the primary device attribute string
println!("\x1B[c");
print!("\x1B[c");
stdout().flush().unwrap();

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

0 comments on commit 25babe8

Please sign in to comment.