working switching of the buffers properly well now
This commit is contained in:
@@ -6,6 +6,7 @@ use crate::services::auth::AuthClient;
|
||||
use crate::config::binds::config::Config;
|
||||
use crate::ui::handlers::rat_state::UiStateHandler;
|
||||
use crate::ui::handlers::context::UiContext;
|
||||
use crate::functions::common::buffer;
|
||||
use crate::tui::{
|
||||
terminal::core::TerminalCore,
|
||||
functions::{
|
||||
@@ -152,11 +153,28 @@ impl EventHandler {
|
||||
&mut self.command_message,
|
||||
).await;
|
||||
match nav_outcome {
|
||||
Ok(EventOutcome::Ok(ref msg)) if msg.is_empty() => {
|
||||
if let Some(action) = config.get_general_action(key_code, modifiers) {
|
||||
match action {
|
||||
"next_buffer" => {
|
||||
if buffer::switch_buffer(buffer_state, true) {
|
||||
return Ok(EventOutcome::Ok("Switched to next buffer".to_string()));
|
||||
}
|
||||
}
|
||||
"previous_buffer" => {
|
||||
if buffer::switch_buffer(buffer_state, false) {
|
||||
return Ok(EventOutcome::Ok("Switched to previous buffer".to_string()));
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(EventOutcome::ButtonSelected { context, index }) => {
|
||||
let mut message = String::from("Selected"); // Default message
|
||||
match context {
|
||||
UiContext::Intro => {
|
||||
intro::handle_intro_selection(app_state, index);
|
||||
intro::handle_intro_selection(app_state, buffer_state, index);
|
||||
if app_state.ui.show_admin {
|
||||
let profile_names = app_state.profile_tree.profiles.iter()
|
||||
.map(|p| p.name.clone())
|
||||
@@ -195,6 +213,24 @@ impl EventHandler {
|
||||
},
|
||||
|
||||
AppMode::ReadOnly => {
|
||||
// --- Buffer Switching Check (ReadOnly Mode) ---
|
||||
if let Some(action) = config.get_read_only_action_for_key(key_code, modifiers) {
|
||||
match action {
|
||||
"next_buffer" => {
|
||||
if buffer::switch_buffer(buffer_state, true) {
|
||||
return Ok(EventOutcome::Ok("Switched to next buffer".to_string()));
|
||||
}
|
||||
}
|
||||
"previous_buffer" => {
|
||||
if buffer::switch_buffer(buffer_state, false) {
|
||||
return Ok(EventOutcome::Ok("Switched to previous buffer".to_string()));
|
||||
}
|
||||
}
|
||||
_ => {} // Other read_only/common actions handled below
|
||||
}
|
||||
}
|
||||
// --- End Buffer Switching Check ---
|
||||
|
||||
if config.is_enter_edit_mode_before(key_code, modifiers) &&
|
||||
ModeManager::can_enter_edit_mode(current_mode) {
|
||||
self.is_edit_mode = true;
|
||||
|
||||
Reference in New Issue
Block a user