more statusbar, keybind & cargo.toml ammendment

This commit is contained in:
Maddie H 2022-11-07 06:52:11 +00:00
parent a8a978d86e
commit 280e569e92
No known key found for this signature in database
GPG Key ID: 64FAA9959751687D
4 changed files with 14 additions and 25 deletions

23
Cargo.lock generated
View File

@ -67,16 +67,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "ctrlc"
version = "3.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d91974fbbe88ec1df0c24a4f00f99583667a7e2e6272b2b92d294d81e462173"
dependencies = [
"nix",
"winapi",
]
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.19" version = "0.1.19"
@ -92,7 +82,6 @@ version = "0.1.0"
dependencies = [ dependencies = [
"colored", "colored",
"crossterm", "crossterm",
"ctrlc",
] ]
[[package]] [[package]]
@ -138,18 +127,6 @@ dependencies = [
"windows-sys", "windows-sys",
] ]
[[package]]
name = "nix"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb"
dependencies = [
"autocfg",
"bitflags",
"cfg-if",
"libc",
]
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.12.1" version = "0.12.1"

View File

@ -6,4 +6,3 @@ edition = "2021"
[dependencies] [dependencies]
crossterm = "0.25" crossterm = "0.25"
colored = "2" colored = "2"
ctrlc = "3.2.3"

1
TODO.md Normal file
View File

@ -0,0 +1 @@
- [ ] Remove colored in favour of crossterm's styling

View File

@ -28,12 +28,19 @@ pub fn draw_status(screen: &mut Screen, editor: &Editor) {
// Get the current open file name // Get the current open file name
let file_name = &format!(" {} ", editor.buffer.name) as &str; let file_name = &format!(" {} ", editor.buffer.name) as &str;
// Calculate where to write the file name // Calculate where to write the file name
let x = editor_logo.len() + mode_string.len() - 1; let x = x + mode_string.len();
// Write the current file name // Write the current file name
screen.write_at( screen.write_at(
file_name.magenta().bold().reversed().to_string(), file_name.magenta().bold().reversed().to_string(),
Coords::from(x, status_height), Coords::from(x, status_height),
); );
// Draw the rest of the status bar
let x = x + file_name.len();
screen.write_at(
" ".repeat(screen.size.width - x).reversed().to_string(),
Coords::from(x, status_height),
);
} }
pub fn start(screen: &mut Screen, editor: Editor) { pub fn start(screen: &mut Screen, editor: Editor) {
@ -48,6 +55,11 @@ pub fn start(screen: &mut Screen, editor: Editor) {
modifiers: KeyModifiers::CONTROL, modifiers: KeyModifiers::CONTROL,
.. ..
}) => break, }) => break,
Event::Key(KeyEvent {
code: KeyCode::Char('c'),
modifiers: KeyModifiers::CONTROL,
..
}) => break,
_ => (), _ => (),
} }
} }