oxedyne/fe2o3/fe2o3_tui/src/lib_tui/text/edit.rs
694 bytes, 5 runs
created by r1870400018:1205, 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 crate::lib_tui::{ |
| 2 | text::nav::Navigator, |
| 3 | }; |
| 4 | |
| 5 | use oxedyne_fe2o3_core::prelude::*; |
| 6 | |
| 7 | use std::{ |
| 8 | fmt, |
| 9 | }; |
| 10 | |
| 11 | |
| 12 | #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] |
| 13 | pub enum EditorMode { |
| 14 | #[default] |
| 15 | Navigation, |
| 16 | Modify, |
| 17 | Insert, |
| 18 | Replace, |
| 19 | } |
| 20 | |
| 21 | impl fmt::Display for EditorMode { |
| 22 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 23 | write!(f, "{}", match self { |
| 24 | Self::Navigation => "NAV", |
| 25 | Self::Modify => "MOD", |
| 26 | Self::Insert => "INS", |
| 27 | Self::Replace => "REP", |
| 28 | }) |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | #[derive(Clone, Debug, Default)] |
| 33 | pub struct Editor { |
| 34 | pub nav: Navigator, |
| 35 | pub mode: EditorMode, |
| 36 | } |