Mikhail Kilin
|
2a5fd6aa35
|
perf: optimize Phase 11 image rendering with dual-protocol architecture
Redesigned UX and performance for inline photo viewing:
UX changes:
- Always-show inline preview (fixed 50 chars width)
- Fullscreen modal on 'v' key with ←/→ navigation between photos
- Loading indicator "⏳ Загрузка..." in modal for first view
- ImageModalState type for modal state management
Performance optimizations:
- Dual renderer architecture:
* inline_image_renderer: Halfblocks protocol (fast, Unicode blocks)
* modal_image_renderer: iTerm2/Sixel protocol (high quality)
- Frame throttling: inline images 15 FPS (66ms), text remains 60 FPS
- Lazy loading: only visible images loaded (was: all images)
- LRU cache: max 100 protocols with eviction
- Skip partial rendering to prevent image shrinking/flickering
Technical changes:
- App: added inline_image_renderer, modal_image_renderer, last_image_render_time
- ImageRenderer: new() for modal (auto-detect), new_fast() for inline (Halfblocks)
- messages.rs: throttled second-pass rendering, visible-only loading
- modals/image_viewer.rs: NEW fullscreen modal with loading state
- ImagesConfig: added inline_image_max_width, auto_download_images
Result: 10x faster navigation, smooth 60 FPS text, quality modal viewing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-02-08 01:36:36 +03:00 |
|
Mikhail Kilin
|
b0f1f9fdc2
|
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>
|
2026-02-06 21:25:17 +03:00 |
|
Mikhail Kilin
|
5ac10ea24c
|
refactor: complete large files/functions refactoring (Phase 6-7)
Phase 6: Refactor tdlib/client.rs ✅
- Extract update handlers to update_handlers.rs (302 lines, 8 functions)
- Extract message converter to message_converter.rs (250 lines, 6 functions)
- Extract chat helpers to chat_helpers.rs (149 lines, 3 functions)
- Result: client.rs 1259 → 599 lines (-52%)
Phase 7: Refactor tdlib/messages.rs ✅
- Create message_conversion.rs module (158 lines)
- Extract 6 helper functions:
- extract_content_text() - content extraction (~80 lines)
- extract_entities() - formatting extraction (~10 lines)
- extract_sender_name() - sender name with API call (~15 lines)
- extract_forward_info() - forward info (~12 lines)
- extract_reply_info() - reply info (~15 lines)
- extract_reactions() - reactions extraction (~26 lines)
- Result: convert_message() 150 → 57 lines (-62%)
- Result: messages.rs 850 → 757 lines (-11%)
Summary:
- ✅ All 4 large files refactored (100%)
- ✅ All 629 tests passing
- ✅ Category #2 "Large files/functions" COMPLETE
- ✅ Documentation updated (REFACTORING_OPPORTUNITIES.md, CONTEXT.md)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-02-04 01:29:26 +03:00 |
|