feat: implement Phase 11 — inline photo viewing with ratatui-image

Add feature-gated (`images`) inline photo support:
- New types: MediaInfo, PhotoInfo, PhotoDownloadState, ImagesConfig
- Media module: ImageCache (LRU filesystem cache), ImageRenderer (terminal protocol detection)
- Photo metadata extraction from TDLib MessagePhoto with download_file() API
- ViewImage command (v/м) to toggle photo expand/collapse in message selection
- Two-pass UI rendering: placeholder lines in message bubbles + StatefulImage overlay
- Collapse all expanded photos on Esc (exit selection mode)

Dependencies: ratatui-image 8.1, image 0.25 (optional, behind `images` feature flag)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Mikhail Kilin
2026-02-06 21:25:17 +03:00
parent 6845ee69bf
commit b0f1f9fdc2
29 changed files with 1505 additions and 102 deletions

View File

@@ -40,6 +40,18 @@ use crossterm::event::KeyEvent;
async fn handle_escape_key<T: TdClientTrait>(app: &mut App<T>) {
// Early return для режима выбора сообщения
if app.is_selecting_message() {
// Свернуть все раскрытые фото (но сохранить Downloaded paths для re-expansion)
#[cfg(feature = "images")]
{
for msg in app.td_client.current_chat_messages_mut() {
if let Some(photo) = msg.photo_info_mut() {
photo.expanded = false;
}
}
if let Some(renderer) = &mut app.image_renderer {
renderer.clear();
}
}
app.chat_state = crate::app::ChatState::Normal;
return;
}