refactor: consolidate small duplicated helpers across the codebase#44
Merged
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (15)
📝 WalkthroughWalkthroughThis pull request consolidates time-related utility functions into a new crate-level Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
8f6e959 to
cf3455f
Compare
f749821 to
c623866
Compare
Four independent cleanups surfaced by the earlier code-reuse review pass, bundled because each is a single-concept sweep: 1. tmux/commands.rs + tmux/panes.rs — route four `run_tmux(["display-message", "-t", …, "-p", …])` direct callers through the existing `display_message()` helper. `pane_session_name`, `get_pane_path`, `get_sidebar_pane_info`, and `select_pane` now share the same trim-and-fallback contract. 2. src/time.rs (new) — centralise `now_epoch_secs()` / `now_epoch_millis()` for hook dispatch, TUI refresh, and the desktop-notification dedup store. `cli/hook/context/meta.rs`, `desktop_notification.rs`, and `state/refresh.rs` each reinvented the same `SystemTime::now().duration_since(UNIX_EPOCH)…` fallback; now they call the shared helpers. 3. state/notices.rs — replace the inline rect hit-test in `notices_copy_target_at` with the existing `state::layout::point_in_rect` helper so both popup click paths share one predicate. 4. ui/bottom/git.rs — extract `diff_stat_spans(ins, del, theme)` to replace structurally identical `+ins/-del` span builders in `files.rs` and `header.rs`. No behavior change. All 1146 tests pass; clippy / fmt clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
c623866 to
4c3e2cd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four independent cleanups from the earlier code-reuse review, bundled because each is a single-concept sweep:
Base
Targets `refactor/unify-notify-lifecycle` (#43) as part of the refactor chain:
`split-large-modules` → `tmux-option-constants` (#42) → `unify-notify-lifecycle` (#43) → this PR.
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit