chore: make clippy happy
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
c782578486
commit
81f1f8ee60
@ -4,11 +4,8 @@ use ratatui::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
command_parser::{CommandParser, Commands},
|
command_parser::CommandParser, commands::IntoCommand, components::GraphExplorer,
|
||||||
commands::IntoCommand,
|
state::SharedState, Msg,
|
||||||
components::GraphExplorer,
|
|
||||||
state::SharedState,
|
|
||||||
Msg,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use self::{
|
use self::{
|
||||||
|
@ -68,12 +68,13 @@ impl BufferState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct InputBuffer {
|
pub struct InputBuffer {
|
||||||
pub state: BufferState,
|
pub state: BufferState,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InputBuffer {
|
impl InputBuffer {
|
||||||
fn to_focused(&mut self) {
|
fn transform_focused(&mut self) {
|
||||||
match &mut self.state {
|
match &mut self.state {
|
||||||
BufferState::Focused { .. } => {}
|
BufferState::Focused { .. } => {}
|
||||||
BufferState::Static { content, position } => {
|
BufferState::Static { content, position } => {
|
||||||
@ -85,7 +86,7 @@ impl InputBuffer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_static(&mut self) {
|
fn transform_static(&mut self) {
|
||||||
match &mut self.state {
|
match &mut self.state {
|
||||||
BufferState::Focused { content, position } => {
|
BufferState::Focused { content, position } => {
|
||||||
self.state = BufferState::Static {
|
self.state = BufferState::Static {
|
||||||
@ -97,6 +98,7 @@ impl InputBuffer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn toggle(&mut self) {
|
pub fn toggle(&mut self) {
|
||||||
match &mut self.state {
|
match &mut self.state {
|
||||||
BufferState::Focused { content, position } => {
|
BufferState::Focused { content, position } => {
|
||||||
@ -116,9 +118,9 @@ impl InputBuffer {
|
|||||||
|
|
||||||
pub fn update(&mut self, msg: &Msg) -> anyhow::Result<()> {
|
pub fn update(&mut self, msg: &Msg) -> anyhow::Result<()> {
|
||||||
match msg {
|
match msg {
|
||||||
Msg::EnterInsertMode => self.to_focused(),
|
Msg::EnterInsertMode => self.transform_focused(),
|
||||||
Msg::EnterCommandMode => self.to_focused(),
|
Msg::EnterCommandMode => self.transform_focused(),
|
||||||
Msg::EnterViewMode => self.to_static(),
|
Msg::EnterViewMode => self.transform_static(),
|
||||||
Msg::Edit(c) => {
|
Msg::Edit(c) => {
|
||||||
self.state.update(c)?;
|
self.state.update(c)?;
|
||||||
}
|
}
|
||||||
@ -136,14 +138,6 @@ impl InputBuffer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for InputBuffer {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
state: BufferState::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct InputField<'a> {
|
pub struct InputField<'a> {
|
||||||
title: &'a str,
|
title: &'a str,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user