Begin mouse mode
This commit is contained in:
parent
0fef72ac5f
commit
a0d0c84eee
1 changed files with 45 additions and 24 deletions
|
@ -607,11 +607,6 @@ impl Terminal {
|
||||||
f(content, cursor_text)
|
f(content, cursor_text)
|
||||||
}
|
}
|
||||||
|
|
||||||
///Scroll the terminal
|
|
||||||
pub fn scroll(&mut self, scroll: Scroll) {
|
|
||||||
self.events.push(InternalEvent::Scroll(scroll));
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn focus_in(&self) {
|
pub fn focus_in(&self) {
|
||||||
if self.last_mode.contains(TermMode::FOCUS_IN_OUT) {
|
if self.last_mode.contains(TermMode::FOCUS_IN_OUT) {
|
||||||
self.write_to_pty("\x1b[I".to_string());
|
self.write_to_pty("\x1b[I".to_string());
|
||||||
|
@ -624,7 +619,19 @@ impl Terminal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///Scroll the terminal
|
||||||
|
pub fn scroll(&mut self, scroll: Scroll) {
|
||||||
|
if self.last_mode.intersects(TermMode::MOUSE_MODE) {
|
||||||
|
//TODE: MOUSE MODE
|
||||||
|
}
|
||||||
|
|
||||||
|
self.events.push(InternalEvent::Scroll(scroll));
|
||||||
|
}
|
||||||
|
|
||||||
pub fn click(&mut self, point: Point, side: Direction, clicks: usize) {
|
pub fn click(&mut self, point: Point, side: Direction, clicks: usize) {
|
||||||
|
if self.last_mode.intersects(TermMode::MOUSE_MODE) {
|
||||||
|
//TODE: MOUSE MODE
|
||||||
|
} else {
|
||||||
let selection_type = match clicks {
|
let selection_type = match clicks {
|
||||||
0 => return, //This is a release
|
0 => return, //This is a release
|
||||||
1 => Some(SelectionType::Simple),
|
1 => Some(SelectionType::Simple),
|
||||||
|
@ -638,14 +645,27 @@ impl Terminal {
|
||||||
|
|
||||||
self.events.push(InternalEvent::SetSelection(selection));
|
self.events.push(InternalEvent::SetSelection(selection));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn mouse_move(&mut self, point: Point, side: Direction, clicks: usize) {
|
||||||
|
if self.last_mode.intersects(TermMode::MOUSE_MODE) {
|
||||||
|
//TODE: MOUSE MODE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn drag(&mut self, point: Point, side: Direction) {
|
pub fn drag(&mut self, point: Point, side: Direction) {
|
||||||
|
if self.last_mode.intersects(TermMode::MOUSE_MODE) {
|
||||||
|
//TODE: MOUSE MODE
|
||||||
|
} else {
|
||||||
self.events
|
self.events
|
||||||
.push(InternalEvent::UpdateSelection((point, side)));
|
.push(InternalEvent::UpdateSelection((point, side)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///TODO: Check if the mouse_down-then-click assumption holds, so this code works as expected
|
|
||||||
pub fn mouse_down(&mut self, point: Point, side: Direction) {
|
pub fn mouse_down(&mut self, point: Point, side: Direction) {
|
||||||
|
if self.last_mode.intersects(TermMode::MOUSE_MODE) {
|
||||||
|
//TODE: MOUSE MODE
|
||||||
|
} else {
|
||||||
self.events
|
self.events
|
||||||
.push(InternalEvent::SetSelection(Some(Selection::new(
|
.push(InternalEvent::SetSelection(Some(Selection::new(
|
||||||
SelectionType::Simple,
|
SelectionType::Simple,
|
||||||
|
@ -653,6 +673,7 @@ impl Terminal {
|
||||||
side,
|
side,
|
||||||
))));
|
))));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for Terminal {
|
impl Drop for Terminal {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue