Added focus-in and focus-out behavior to terminal

This commit is contained in:
Mikayla Maki 2022-08-15 15:59:17 -07:00
parent e14f2b3d9f
commit 761b211e89
3 changed files with 38 additions and 11 deletions

View file

@ -601,18 +601,23 @@ impl Terminal {
f(content, cursor_text)
}
// fn estimate_utilization(last_processed: usize) -> f32 {
// let buffer_utilization = (last_processed as f32 / (READ_BUFFER_SIZE as f32)).clamp(0., 1.);
// //Scale result to bias low, then high
// buffer_utilization * buffer_utilization
// }
///Scroll the terminal
pub fn scroll(&mut self, scroll: Scroll) {
self.events.push(InternalEvent::Scroll(scroll));
}
pub fn focus_in(&self) {
if self.last_mode.contains(TermMode::FOCUS_IN_OUT) {
self.notify_pty("\x1b[I".to_string());
}
}
pub fn focus_out(&self) {
if self.last_mode.contains(TermMode::FOCUS_IN_OUT) {
self.notify_pty("\x1b[O".to_string());
}
}
pub fn click(&mut self, point: Point, side: Direction, clicks: usize) {
let selection_type = match clicks {
0 => return, //This is a release