more statusbar, keybind & cargo.toml ammendment
This commit is contained in:
parent
a8a978d86e
commit
280e569e92
23
Cargo.lock
generated
23
Cargo.lock
generated
@ -67,16 +67,6 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ctrlc"
|
||||
version = "3.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d91974fbbe88ec1df0c24a4f00f99583667a7e2e6272b2b92d294d81e462173"
|
||||
dependencies = [
|
||||
"nix",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
@ -92,7 +82,6 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"colored",
|
||||
"crossterm",
|
||||
"ctrlc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -138,18 +127,6 @@ dependencies = [
|
||||
"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]]
|
||||
name = "parking_lot"
|
||||
version = "0.12.1"
|
||||
|
@ -6,4 +6,3 @@ edition = "2021"
|
||||
[dependencies]
|
||||
crossterm = "0.25"
|
||||
colored = "2"
|
||||
ctrlc = "3.2.3"
|
||||
|
14
src/tui.rs
14
src/tui.rs
@ -28,12 +28,19 @@ pub fn draw_status(screen: &mut Screen, editor: &Editor) {
|
||||
// Get the current open file name
|
||||
let file_name = &format!(" {} ", editor.buffer.name) as &str;
|
||||
// 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
|
||||
screen.write_at(
|
||||
file_name.magenta().bold().reversed().to_string(),
|
||||
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) {
|
||||
@ -48,6 +55,11 @@ pub fn start(screen: &mut Screen, editor: Editor) {
|
||||
modifiers: KeyModifiers::CONTROL,
|
||||
..
|
||||
}) => break,
|
||||
Event::Key(KeyEvent {
|
||||
code: KeyCode::Char('c'),
|
||||
modifiers: KeyModifiers::CONTROL,
|
||||
..
|
||||
}) => break,
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user