mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Crossterm: use button from upstream rather than last_button
This commit is contained in:
parent
9de4d206bf
commit
4b0b9265ee
@ -44,7 +44,6 @@ type Stdout = File;
|
|||||||
/// Backend using crossterm
|
/// Backend using crossterm
|
||||||
pub struct Backend {
|
pub struct Backend {
|
||||||
current_style: Cell<theme::ColorPair>,
|
current_style: Cell<theme::ColorPair>,
|
||||||
last_button: Option<MouseButton>,
|
|
||||||
|
|
||||||
stdout: RefCell<BufWriter<Stdout>>,
|
stdout: RefCell<BufWriter<Stdout>>,
|
||||||
}
|
}
|
||||||
@ -218,7 +217,6 @@ impl Backend {
|
|||||||
|
|
||||||
Ok(Box::new(Backend {
|
Ok(Box::new(Backend {
|
||||||
current_style: Cell::new(theme::ColorPair::from_256colors(0, 0)),
|
current_style: Cell::new(theme::ColorPair::from_256colors(0, 0)),
|
||||||
last_button: None,
|
|
||||||
stdout,
|
stdout,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@ -250,16 +248,17 @@ impl Backend {
|
|||||||
match mouse_event {
|
match mouse_event {
|
||||||
CMouseEvent::Down(button, x, y, _) => {
|
CMouseEvent::Down(button, x, y, _) => {
|
||||||
let button = MouseButton::from(button);
|
let button = MouseButton::from(button);
|
||||||
self.last_button = Some(button);
|
|
||||||
event = MouseEvent::Press(button);
|
event = MouseEvent::Press(button);
|
||||||
position = (x, y).into();
|
position = (x, y).into();
|
||||||
}
|
}
|
||||||
CMouseEvent::Up(_, x, y, _) => {
|
CMouseEvent::Up(button, x, y, _) => {
|
||||||
event = MouseEvent::Release(self.last_button.unwrap());
|
let button = MouseButton::from(button);
|
||||||
|
event = MouseEvent::Release(button);
|
||||||
position = (x, y).into();
|
position = (x, y).into();
|
||||||
}
|
}
|
||||||
CMouseEvent::Drag(_, x, y, _) => {
|
CMouseEvent::Drag(button, x, y, _) => {
|
||||||
event = MouseEvent::Hold(self.last_button.unwrap());
|
let button = MouseButton::from(button);
|
||||||
|
event = MouseEvent::Hold(button);
|
||||||
position = (x, y).into();
|
position = (x, y).into();
|
||||||
}
|
}
|
||||||
CMouseEvent::ScrollDown(x, y, _) => {
|
CMouseEvent::ScrollDown(x, y, _) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user