not exiting when entering through the app
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
// src/client/ui.rs
|
// src/client/ui.rs
|
||||||
use crossterm::event::{Event, KeyCode, KeyModifiers};
|
use crossterm::event::{Event, KeyCode, KeyModifiers};
|
||||||
use crate::client::terminal::AppTerminal;
|
use crate::client::terminal::AppTerminal;
|
||||||
use crate::client::components::{render_command_line, render_form, render_preview_card, render_status_line}; // Add `render_status_line`
|
use crate::client::components::{render_command_line, render_form, render_preview_card, render_status_line};
|
||||||
use crate::client::colors::Theme;
|
use crate::client::colors::Theme;
|
||||||
use ratatui::layout::{Constraint, Direction, Layout, Rect};
|
use ratatui::layout::{Constraint, Direction, Layout, Rect};
|
||||||
use std::env;
|
use std::env;
|
||||||
@@ -87,7 +87,7 @@ pub fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
render_command_line(f, root[2], &command_input, command_mode, &theme);
|
render_command_line(f, root[2], &command_input, command_mode, &theme);
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// Event handling (unchanged)
|
// Event handling
|
||||||
if let Event::Key(key) = app_terminal.read_event()? {
|
if let Event::Key(key) = app_terminal.read_event()? {
|
||||||
if command_mode {
|
if command_mode {
|
||||||
match key.code {
|
match key.code {
|
||||||
@@ -132,6 +132,10 @@ pub fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
KeyCode::BackTab => current_field = current_field.saturating_sub(1),
|
KeyCode::BackTab => current_field = current_field.saturating_sub(1),
|
||||||
KeyCode::Down => current_field = (current_field + 1) % fields.len(),
|
KeyCode::Down => current_field = (current_field + 1) % fields.len(),
|
||||||
KeyCode::Up => current_field = current_field.saturating_sub(1),
|
KeyCode::Up => current_field = current_field.saturating_sub(1),
|
||||||
|
KeyCode::Enter => {
|
||||||
|
// Move to the next field, wrapping around to the first field if necessary
|
||||||
|
current_field = (current_field + 1) % fields.len();
|
||||||
|
}
|
||||||
KeyCode::Char(c) => {
|
KeyCode::Char(c) => {
|
||||||
match current_field {
|
match current_field {
|
||||||
0 => firma.push(c),
|
0 => firma.push(c),
|
||||||
@@ -172,13 +176,6 @@ pub fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
KeyCode::Enter => {
|
|
||||||
if current_field == fields.len() - 1 {
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
current_field += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user