review(p9-fb-12 follow-up): 회차 1 nit 반영

- search::handle_key_search 의 j/k 두 개 arm (Insert 가드 + Normal
  no-guard) 을 single arm + body if-branch 로 flatten. 4 arm → 2 arm,
  \"j/k 가 mode 따라 다르다\" 가 한 자리에서 보임. ask.rs 패턴과 정렬.
- `is_typing_mod` 자리에 남아있던 \"removed\" placeholder 코멘트 3 줄
  삭제. commit history 와 매치 블록 안 코멘트 가 reference.

113 TUI 테스트 통과 + clippy clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-03 07:54:19 +00:00
parent 765ffc97c5
commit 0665e0b2be

View File

@@ -289,29 +289,27 @@ pub fn handle_key_search(state: &mut App, key: KeyEvent) -> KeyOutcome {
KeyOutcome::Continue
}
// p9-fb-12 follow-up: Char dispatch is mode-gated. Normal
// mode → j/k navigate, other Char fall through (no typing).
// Insert mode → every non-chord Char is typed.
(KeyCode::Char('j'), KeyModifiers::NONE) if !is_normal => {
// 'j' in Insert types literally; falls through to the
// catch-all Insert branch below. (This guard short-
// circuits so the navigation arm doesn't fire.)
s.input.push('j');
s.input_dirty_at = Some(time::OffsetDateTime::now_utc());
KeyOutcome::Continue
}
(KeyCode::Char('k'), KeyModifiers::NONE) if !is_normal => {
s.input.push('k');
s.input_dirty_at = Some(time::OffsetDateTime::now_utc());
KeyOutcome::Continue
}
// mode → j/k navigate; Insert mode → typed into input.
// Single arm per key, body branches on mode (clearer than
// duplicate-arm + guard).
(KeyCode::Char('j'), KeyModifiers::NONE) => {
move_selection(s, 1);
s.preview = None;
if is_normal {
move_selection(s, 1);
s.preview = None;
} else {
s.input.push('j');
s.input_dirty_at = Some(time::OffsetDateTime::now_utc());
}
KeyOutcome::Continue
}
(KeyCode::Char('k'), KeyModifiers::NONE) => {
move_selection(s, -1);
s.preview = None;
if is_normal {
move_selection(s, -1);
s.preview = None;
} else {
s.input.push('k');
s.input_dirty_at = Some(time::OffsetDateTime::now_utc());
}
KeyOutcome::Continue
}
(KeyCode::Char(c), m)
@@ -341,10 +339,6 @@ fn cycle_mode(m: SearchMode) -> SearchMode {
}
}
// p9-fb-12 follow-up: `is_typing_mod` removed. Mode field on `App`
// is now authoritative — the dispatch above gates Char handling on
// `state.mode`, not on modifier-vs-input heuristics.
fn move_selection(s: &mut SearchState, delta: i32) {
if s.hits.is_empty() {
return;