fixes
This commit is contained in:
@@ -3,6 +3,16 @@
|
||||
use crate::tdlib::{MessageInfo, ProfileInfo};
|
||||
use crate::types::MessageId;
|
||||
|
||||
/// Vim-like input mode for chat view
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||
pub enum InputMode {
|
||||
/// Normal mode — navigation and commands (default)
|
||||
#[default]
|
||||
Normal,
|
||||
/// Insert mode — text input only
|
||||
Insert,
|
||||
}
|
||||
|
||||
/// Состояния чата - взаимоисключающие режимы работы с чатом
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum ChatState {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//!
|
||||
//! Handles chat list navigation and selection
|
||||
|
||||
use crate::app::{App, ChatState};
|
||||
use crate::app::{App, ChatState, InputMode};
|
||||
use crate::app::methods::search::SearchMethods;
|
||||
use crate::tdlib::TdClientTrait;
|
||||
|
||||
@@ -84,6 +84,7 @@ impl<T: TdClientTrait> NavigationMethods<T> for App<T> {
|
||||
self.last_typing_sent = None;
|
||||
// Сбрасываем состояние чата в нормальный режим
|
||||
self.chat_state = ChatState::Normal;
|
||||
self.input_mode = InputMode::Normal;
|
||||
// Очищаем данные в TdClient
|
||||
self.td_client.set_current_chat_id(None);
|
||||
self.td_client.clear_current_chat_messages();
|
||||
|
||||
@@ -9,7 +9,7 @@ mod state;
|
||||
pub mod methods;
|
||||
|
||||
pub use chat_filter::{ChatFilter, ChatFilterCriteria};
|
||||
pub use chat_state::ChatState;
|
||||
pub use chat_state::{ChatState, InputMode};
|
||||
pub use state::AppScreen;
|
||||
pub use methods::*;
|
||||
|
||||
@@ -60,6 +60,8 @@ pub struct App<T: TdClientTrait = TdClient> {
|
||||
pub td_client: T,
|
||||
/// Состояние чата - type-safe state machine (новое!)
|
||||
pub chat_state: ChatState,
|
||||
/// Vim-like input mode: Normal (navigation) / Insert (text input)
|
||||
pub input_mode: InputMode,
|
||||
// Auth state (приватные, доступ через геттеры)
|
||||
phone_input: String,
|
||||
code_input: String,
|
||||
@@ -144,6 +146,7 @@ impl<T: TdClientTrait> App<T> {
|
||||
screen: AppScreen::Loading,
|
||||
td_client,
|
||||
chat_state: ChatState::Normal,
|
||||
input_mode: InputMode::Normal,
|
||||
phone_input: String::new(),
|
||||
code_input: String::new(),
|
||||
password_input: String::new(),
|
||||
|
||||
Reference in New Issue
Block a user