Skip to content

Commit

Permalink
Unnecessary parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Paddyk45 committed Dec 11, 2023
1 parent 969434f commit 8465001
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,26 @@ pub fn ui(frame: &mut Frame, app: Arc<RwLock<App>>) {


impl App {
pub fn move_cursor_left(&mut self, amount: usize) {
let moved = self.cursor_pos.saturating_sub(amount);
pub fn move_cursor_left(&mut self) {
let moved = self.cursor_pos.saturating_sub(1);
self.cursor_pos = moved.clamp(0, self.input.len());
}
pub fn move_cursor_right(&mut self, amount: usize) {
let moved = self.cursor_pos + amount;
pub fn move_cursor_right(&mut self) {
let moved = self.cursor_pos + 1;
self.cursor_pos = moved.clamp(0, self.input.len());
}

pub fn enter(&mut self, ch: char) {
self.input.insert(self.cursor_pos, ch);
self.move_cursor_right(1);
self.move_cursor_right();
}

pub fn delete(&mut self) {
if self.cursor_pos == 0 {
return;
}
self.input.remove(self.cursor_pos - 1);
self.move_cursor_left(1);
self.move_cursor_left();
}

pub fn reset_cursor(&mut self) {
Expand Down

0 comments on commit 8465001

Please sign in to comment.