fix fmt errors
This commit is contained in:
parent
fd1debaa79
commit
5d06a49f8a
2 changed files with 65 additions and 42 deletions
|
|
@ -218,35 +218,6 @@ impl ServerOsApi for FakeInputOutput {
|
||||||
fn box_clone(&self) -> Box<dyn ServerOsApi> {
|
fn box_clone(&self) -> Box<dyn ServerOsApi> {
|
||||||
Box::new((*self).clone())
|
Box::new((*self).clone())
|
||||||
}
|
}
|
||||||
fn read_from_stdin(&self) -> Vec<u8> {
|
|
||||||
loop {
|
|
||||||
let last_snapshot_time = { *self.last_snapshot_time.lock().unwrap() };
|
|
||||||
if last_snapshot_time.elapsed() > MIN_TIME_BETWEEN_SNAPSHOTS {
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
::std::thread::sleep(MIN_TIME_BETWEEN_SNAPSHOTS - last_snapshot_time.elapsed());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let command = self
|
|
||||||
.stdin_commands
|
|
||||||
.lock()
|
|
||||||
.unwrap()
|
|
||||||
.pop_front()
|
|
||||||
.unwrap_or(vec![]);
|
|
||||||
if command == SLEEP {
|
|
||||||
std::thread::sleep(std::time::Duration::from_millis(200));
|
|
||||||
} else if command == QUIT && self.sigwinch_event.is_some() {
|
|
||||||
let (lock, cvar) = &*self.should_trigger_sigwinch;
|
|
||||||
let mut should_trigger_sigwinch = lock.lock().unwrap();
|
|
||||||
*should_trigger_sigwinch = true;
|
|
||||||
cvar.notify_one();
|
|
||||||
::std::thread::sleep(MIN_TIME_BETWEEN_SNAPSHOTS); // give some time for the app to resize before quitting
|
|
||||||
}
|
|
||||||
command
|
|
||||||
}
|
|
||||||
fn get_stdout_writer(&self) -> Box<dyn Write> {
|
|
||||||
Box::new(self.stdout_writer.clone())
|
|
||||||
}
|
|
||||||
fn kill(&mut self, fd: RawFd) -> Result<(), nix::Error> {
|
fn kill(&mut self, fd: RawFd) -> Result<(), nix::Error> {
|
||||||
self.io_events.lock().unwrap().push(IoEvent::Kill(fd));
|
self.io_events.lock().unwrap().push(IoEvent::Kill(fd));
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,11 @@ pub fn resize_down_with_pane_above() {
|
||||||
&SLEEP,
|
&SLEEP,
|
||||||
&QUIT,
|
&QUIT,
|
||||||
]);
|
]);
|
||||||
start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone()));
|
start(
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
CliArgs::default(),
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -83,7 +87,11 @@ pub fn resize_down_with_pane_below() {
|
||||||
&SLEEP,
|
&SLEEP,
|
||||||
&QUIT,
|
&QUIT,
|
||||||
]);
|
]);
|
||||||
start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone()));
|
start(
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
CliArgs::default(),
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -129,7 +137,11 @@ pub fn resize_down_with_panes_above_and_below() {
|
||||||
&SLEEP,
|
&SLEEP,
|
||||||
&QUIT,
|
&QUIT,
|
||||||
]);
|
]);
|
||||||
start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone()));
|
start(
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
CliArgs::default(),
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -174,7 +186,11 @@ pub fn resize_down_with_multiple_panes_above() {
|
||||||
&QUIT,
|
&QUIT,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone()));
|
start(
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
CliArgs::default(),
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -221,7 +237,11 @@ pub fn resize_down_with_panes_above_aligned_left_with_current_pane() {
|
||||||
&QUIT,
|
&QUIT,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone()));
|
start(
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
CliArgs::default(),
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -267,7 +287,11 @@ pub fn resize_down_with_panes_below_aligned_left_with_current_pane() {
|
||||||
&QUIT,
|
&QUIT,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone()));
|
start(
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
CliArgs::default(),
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -311,7 +335,11 @@ pub fn resize_down_with_panes_above_aligned_right_with_current_pane() {
|
||||||
&QUIT,
|
&QUIT,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone()));
|
start(
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
CliArgs::default(),
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -356,7 +384,11 @@ pub fn resize_down_with_panes_below_aligned_right_with_current_pane() {
|
||||||
&QUIT,
|
&QUIT,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone()));
|
start(
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
CliArgs::default(),
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -404,7 +436,11 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_current_pane() {
|
||||||
&QUIT,
|
&QUIT,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone()));
|
start(
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
CliArgs::default(),
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -454,7 +490,11 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_current_pane() {
|
||||||
&QUIT,
|
&QUIT,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone()));
|
start(
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
CliArgs::default(),
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -521,7 +561,11 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_panes_to_the_lef
|
||||||
&QUIT,
|
&QUIT,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone()));
|
start(
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
CliArgs::default(),
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -590,7 +634,11 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_to_the_left_and_
|
||||||
&QUIT,
|
&QUIT,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone()));
|
start(
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
CliArgs::default(),
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
@ -627,7 +675,11 @@ pub fn cannot_resize_down_when_pane_below_is_at_minimum_height() {
|
||||||
&SLEEP,
|
&SLEEP,
|
||||||
&QUIT,
|
&QUIT,
|
||||||
]);
|
]);
|
||||||
start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone()));
|
start(
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
CliArgs::default(),
|
||||||
|
Box::new(fake_input_output.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
let output_frames = fake_input_output
|
let output_frames = fake_input_output
|
||||||
.stdout_writer
|
.stdout_writer
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue