Some checks failed
ci/woodpecker/pr/check Pipeline failed
CI / Check (pull_request) Has been cancelled
CI / Format (pull_request) Has been cancelled
CI / Clippy (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build (windows-latest) (pull_request) Has been cancelled
43 lines
1.3 KiB
Rust
43 lines
1.3 KiB
Rust
//! Input handlers organized by functionality
|
||
//!
|
||
//! This module contains handlers for different input contexts:
|
||
//! - global: Global commands (Ctrl+R, Ctrl+S, etc.)
|
||
//! - clipboard: Clipboard operations
|
||
//! - profile: Profile helper functions
|
||
//! - chat: Keyboard input handling for open chat view
|
||
//! - chat_list: Navigation and interaction in the chat list
|
||
//! - compose: Text input, editing, and message composition
|
||
//! - modal: Modal dialogs (delete confirmation, emoji picker, etc.)
|
||
//! - search: Search functionality (chat search, message search)
|
||
|
||
pub mod chat;
|
||
pub mod chat_list;
|
||
pub mod clipboard;
|
||
pub mod compose;
|
||
pub mod global;
|
||
pub mod modal;
|
||
pub mod profile;
|
||
pub mod search;
|
||
|
||
pub use clipboard::*;
|
||
pub use global::*;
|
||
pub use profile::get_available_actions_count;
|
||
|
||
use crate::app::App;
|
||
use crate::tdlib::TdClientTrait;
|
||
use crate::types::MessageId;
|
||
|
||
/// Скроллит к сообщению по его ID в текущем чате
|
||
pub fn scroll_to_message<T: TdClientTrait>(app: &mut App<T>, message_id: MessageId) {
|
||
let msg_index = app
|
||
.td_client
|
||
.current_chat_messages()
|
||
.iter()
|
||
.position(|m| m.id() == message_id);
|
||
|
||
if let Some(idx) = msg_index {
|
||
let total = app.td_client.current_chat_messages().len();
|
||
app.message_scroll_offset = total.saturating_sub(idx + 5);
|
||
}
|
||
}
|