added colours, select and delete ops, refac
This commit is contained in:
16
src/main.rs
16
src/main.rs
@@ -63,6 +63,13 @@ fn runApp<B: Backend>(app: &mut AppState, terminal: &mut Terminal<B>) -> Result<
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
CurrentScreen::Delete => match key.code {
|
||||
KeyCode::Up => app.nextRow(),
|
||||
KeyCode::Down => app.prevRow(),
|
||||
KeyCode::Enter => app.delCur(),
|
||||
KeyCode::Esc => app.screen = CurrentScreen::Main,
|
||||
_ => {}
|
||||
},
|
||||
CurrentScreen::Main => match key.code {
|
||||
KeyCode::Char('a') => {
|
||||
app.screen = CurrentScreen::Add;
|
||||
@@ -72,6 +79,9 @@ fn runApp<B: Backend>(app: &mut AppState, terminal: &mut Terminal<B>) -> Result<
|
||||
app.screen = CurrentScreen::Exit
|
||||
}
|
||||
KeyCode::Char('s') | KeyCode::F(2) => app.screen = CurrentScreen::Settings,
|
||||
KeyCode::Char('d') => app.screen = CurrentScreen::Delete,
|
||||
KeyCode::Up => app.nextRow(),
|
||||
KeyCode::Down => app.prevRow(),
|
||||
_ => {}
|
||||
},
|
||||
CurrentScreen::Add => match (key.modifiers, key.code) {
|
||||
@@ -134,6 +144,12 @@ fn runApp<B: Backend>(app: &mut AppState, terminal: &mut Terminal<B>) -> Result<
|
||||
opField.push_str("127.0.0.1");
|
||||
}
|
||||
}
|
||||
'o' => {
|
||||
if isIP {
|
||||
opField.clear();
|
||||
opField.push_str("0.0.0.0");
|
||||
}
|
||||
}
|
||||
'c' => opField.clear(),
|
||||
'C' => {
|
||||
app.fromIP.clear();
|
||||
|
||||
Reference in New Issue
Block a user