refactor: prepare handlers structure for future input refactoring

Preparation for splitting large input file (#2):
- Created src/input/handlers/ structure (7 modules)
  - clipboard.rs (~100 lines) - clipboard operations extracted
  - global.rs (~90 lines) - global commands (Ctrl+R/S/P/F) extracted
  - Stubs: profile.rs, search.rs, modal.rs, messages.rs, chat_list.rs
- main_input.rs remains monolithic (1139 lines)
  - Attempted full migration broke navigation - rolled back
  - Handlers remain as preparation for gradual migration

Updated documentation:
- REFACTORING_OPPORTUNITIES.md: #2.1 status updated
- CONTEXT.md: Added lesson about careful refactoring

Lesson learned: Critical input logic requires careful step-by-step
refactoring with functionality verification after each step.

Tests: 563 passed, 0 failed

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Mikhail Kilin
2026-02-02 00:08:56 +03:00
parent dff0897da4
commit 4d9d76ed23
12 changed files with 1485 additions and 8 deletions

View File

@@ -69,7 +69,7 @@
## 2. Большие файлы/функции
**Приоритет:** 🔴 Высокий
**Статус:** Не начато
**Статус:** ✅ Частично выполнено (2026-02-01)
**Объем:** 4 файла, 1000+ строк каждый
### Проблемы
@@ -83,14 +83,15 @@
### Решение
#### 2.1. Разделить `src/input/main_input.rs`
#### 2.1. Разделить `src/input/main_input.rs` - ⏳ В процессе (2026-02-01)
- [ ] Создать `src/input/handlers/chat_list_input.rs`
- [ ] Создать `src/input/handlers/messages_input.rs`
- [ ] Создать `src/input/handlers/compose_input.rs`
- [ ] Создать `src/input/handlers/search_input.rs`
- [ ] Создать `src/input/handlers/modal_input.rs`
- [ ] Главный `handle()` делегирует по screen state
- [x] Создана структура `src/input/handlers/` (7 модулей) - ПОДГОТОВКА
- [x] Создан `handlers/clipboard.rs` (~100 строк) - извлечён из main_input
- [x] Создан `handlers/global.rs` (~90 строк) - извлечён из main_input
- [x] Созданы заглушки: `profile.rs`, `search.rs`, `modal.rs`, `messages.rs`, `chat_list.rs`
- [ ] Постепенно мигрировать логику в handlers (требуется тщательное тестирование)
**Примечание**: Попытка полного переноса была откачена из-за поломки навигации. Handlers остаются как подготовка к будущей миграции. Текущий подход: извлекать независимые модули (clipboard, global), не трогая критичную логику ввода.
#### 2.2. Разделить `src/tdlib/client.rs`