diff --git a/src/controller/key_event_matcher/rename.rs b/src/controller/key_event_matcher/rename.rs index 8083968..425465d 100644 --- a/src/controller/key_event_matcher/rename.rs +++ b/src/controller/key_event_matcher/rename.rs @@ -8,7 +8,7 @@ use termion::event::Key as TKey; use crate::controller::EventQueue; impl EventQueue { - /// TODO + /// Remove the last character from the string. fn pop_char(name: &str) -> Cow<'_, str> { if name.is_empty() { return Cow::Borrowed(name); @@ -18,7 +18,7 @@ impl EventQueue { Cow::Owned(chars.collect()) } - /// TODO + /// Add a character to the string, if it is not a control character. fn push_char<'a>(name: &'a str, chr: &char) -> Cow<'a, str> { if chr.is_control() { return Cow::Borrowed(name); @@ -26,7 +26,7 @@ impl EventQueue { Cow::Owned(format!("{name}{chr}")) } - /// TODO + /// Rename the current file to the new name. pub fn do_rename_current_file(&mut self, new_name: &str) -> Option<()> { let new_path = self.pager.current_entry.with_file_name(new_name); if !new_path.exists() { @@ -35,7 +35,7 @@ impl EventQueue { Some(()) } - /// TODO + /// Handle the rename input, and return the new name. pub fn do_handle_rename_input<'a>(&mut self, new_name: &'a str, key: &TKey) -> Cow<'a, str> { match key { TKey::Backspace => return Self::pop_char(new_name), diff --git a/src/controller/mod.rs b/src/controller/mod.rs index 551ce57..1f0ccdd 100644 --- a/src/controller/mod.rs +++ b/src/controller/mod.rs @@ -23,7 +23,7 @@ mod key_event_handler; mod key_event_matcher; mod resize_event_handler; -/// TODO +/// Entrie, a struct that represents a file or directory. pub struct Entrie { pub path: PathBuf, pub display_text: String, @@ -115,7 +115,7 @@ impl EventQueue { } impl Entrie { - /// TODO + /// Create a new `Entrie`. pub fn new(path: impl AsRef, display_text: impl Into) -> Self { Self { path: path.as_ref().to_path_buf(), diff --git a/src/model/event.rs b/src/model/event.rs index 5bdf307..26a7dd1 100644 --- a/src/model/event.rs +++ b/src/model/event.rs @@ -40,7 +40,7 @@ impl From<&String> for Key { } impl Key { - /// TODO + /// Returns the inner termion key event. pub fn inner(&self) -> &TKey { match &self.inner { termion::event::Event::Key(tkey) => tkey, diff --git a/src/view/mode.rs b/src/view/mode.rs index 3ae9c62..037eed1 100644 --- a/src/view/mode.rs +++ b/src/view/mode.rs @@ -1,17 +1,17 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2024 Awiteb -/// TODO +/// Mode of the pager. #[derive(Clone)] pub enum Mode { - /// TODO + /// Normal mode. Exploring the file system. Normal, - /// TODO + /// Rename mode. Renaming a file. Rename(String), } impl Mode { - /// TODO + /// Returns the new name of the file, if in rename mode. pub fn new_name(&self) -> Option<&str> { match &self { Mode::Rename(new_name) => Some(new_name),