oxedyne/fe2o3/fe2o3_tui/src/lib_tui/text/nav.rs
626 bytes, 7 runs
created by r1870400018:1211, which is this file's identity for as long as the history lasts, whatever it is later renamed to
download · who wrote it · its history
| 1 | use oxedyne_fe2o3_core::prelude::*; |
| 2 | use oxedyne_fe2o3_geom::dim::Coord; |
| 3 | |
| 4 | |
| 5 | #[derive(Clone, Debug)] |
| 6 | pub enum PositionCursor { |
| 7 | UserControlled, |
| 8 | LatestLine(bool), // Show or hide cursor? |
| 9 | } |
| 10 | |
| 11 | impl Default for PositionCursor { |
| 12 | fn default() -> Self { |
| 13 | Self::UserControlled |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | #[derive(Clone, Debug, Default)] |
| 18 | pub struct Navigator { |
| 19 | pub cursor: Coord, |
| 20 | } |
| 21 | |
| 22 | impl Navigator { |
| 23 | pub fn new( |
| 24 | cursor: Option<Coord>, |
| 25 | ) |
| 26 | -> Self |
| 27 | { |
| 28 | Self { |
| 29 | cursor: match cursor { |
| 30 | Some(coord) => coord, |
| 31 | None => Coord::zero(), |
| 32 | }, |
| 33 | } |
| 34 | } |
| 35 | } |