fixes
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
//! - Loading older messages
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::InputMode;
|
||||
use crate::app::methods::{
|
||||
compose::ComposeMethods, messages::MessageMethods,
|
||||
modal::ModalMethods, navigation::NavigationMethods,
|
||||
@@ -48,8 +49,13 @@ pub async fn handle_message_selection<T: TdClientTrait>(app: &mut App<T>, _key:
|
||||
};
|
||||
}
|
||||
}
|
||||
Some(crate::config::Command::EnterInsertMode) => {
|
||||
app.input_mode = InputMode::Insert;
|
||||
app.chat_state = crate::app::ChatState::Normal;
|
||||
}
|
||||
Some(crate::config::Command::ReplyMessage) => {
|
||||
app.start_reply_to_selected();
|
||||
app.input_mode = InputMode::Insert;
|
||||
}
|
||||
Some(crate::config::Command::ForwardMessage) => {
|
||||
app.start_forward_selected();
|
||||
@@ -243,7 +249,9 @@ pub async fn handle_enter_key<T: TdClientTrait>(app: &mut App<T>) {
|
||||
|
||||
// Сценарий 2: Режим выбора сообщения - начать редактирование
|
||||
if app.is_selecting_message() {
|
||||
if !app.start_editing_selected() {
|
||||
if app.start_editing_selected() {
|
||||
app.input_mode = InputMode::Insert;
|
||||
} else {
|
||||
// Нельзя редактировать это сообщение
|
||||
app.chat_state = crate::app::ChatState::Normal;
|
||||
}
|
||||
@@ -452,24 +460,16 @@ pub async fn handle_open_chat_keyboard_input<T: TdClientTrait>(app: &mut App<T>,
|
||||
// Курсор в конец
|
||||
app.cursor_position = app.message_input.chars().count();
|
||||
}
|
||||
// Стрелки вверх/вниз - скролл сообщений или начало выбора
|
||||
// Стрелки вверх/вниз - скролл сообщений (в Insert mode)
|
||||
KeyCode::Down => {
|
||||
// Скролл вниз (к новым сообщениям)
|
||||
if app.message_scroll_offset > 0 {
|
||||
app.message_scroll_offset = app.message_scroll_offset.saturating_sub(3);
|
||||
}
|
||||
}
|
||||
KeyCode::Up => {
|
||||
// Если инпут пустой и не в режиме редактирования — начать выбор сообщения
|
||||
if app.message_input.is_empty() && !app.is_editing() {
|
||||
app.start_message_selection();
|
||||
} else {
|
||||
// Скролл вверх (к старым сообщениям)
|
||||
app.message_scroll_offset += 3;
|
||||
|
||||
// Подгружаем старые сообщения если нужно
|
||||
load_older_messages_if_needed(app).await;
|
||||
}
|
||||
// В Insert mode — только скролл
|
||||
app.message_scroll_offset += 3;
|
||||
load_older_messages_if_needed(app).await;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
//! - Opening chats
|
||||
|
||||
use crate::app::App;
|
||||
use crate::app::methods::{compose::ComposeMethods, navigation::NavigationMethods};
|
||||
use crate::app::InputMode;
|
||||
use crate::app::methods::{compose::ComposeMethods, messages::MessageMethods, navigation::NavigationMethods};
|
||||
use crate::tdlib::TdClientTrait;
|
||||
use crate::types::{ChatId, MessageId};
|
||||
use crate::utils::{with_timeout, with_timeout_msg, with_timeout_ignore};
|
||||
@@ -135,6 +136,10 @@ pub async fn open_chat_and_load_data<T: TdClientTrait>(app: &mut App<T>, chat_id
|
||||
// Загружаем черновик
|
||||
app.load_draft();
|
||||
app.status_message = None;
|
||||
|
||||
// Vim mode: Normal + MessageSelection по умолчанию
|
||||
app.input_mode = InputMode::Normal;
|
||||
app.start_message_selection();
|
||||
}
|
||||
Err(e) => {
|
||||
app.error_message = Some(e);
|
||||
|
||||
Reference in New Issue
Block a user