Repository navigation
feat: add clipboard copy for messages with 'y' keybinding - #94
Conversation
- Add arboard dependency for cross-platform clipboard access - Add CopyMessage action bound to 'y' key - Implement copy_selected_message() to copy plain text to clipboard - Extract text with priority: text > markdown > html (converted) - Make CopyMessage available when a message is selected Fixes #56 Co-authored-by: Sam Grimee - LX2SG <sgrimee@users.noreply.github.com>
0c7f669 to
325e981
Compare
Code Review: Clipboard Copy FeatureThank you for implementing the clipboard copy functionality! This is a useful feature that addresses issue #56. Strengths
Issues and Recommendations1. Inconsistent Content Priority Order (Medium Priority)The copy function prioritizes content differently than the UI rendering:
Recommendation: Match the UI's priority order so users copy what they see displayed. 2. Width Parameter Discrepancy (Low Priority)The UI uses text_width for html2text::from_read, but the copy function uses usize::MAX. This means copied text won't match displayed formatting. Recommendation: Consider a reasonable default width (e.g., 80 or 120 columns) for better formatting consistency. 3. Missing User-Visible Feedback (Medium Priority)Success only logs to the debug logger. Users might be unsure if the copy succeeded. Recommendation: Consider adding a status message or brief visual indicator. 4. No Test Coverage (Medium Priority)The PR adds new functionality without tests. Recommendation: Add unit tests for different content types, error handling, and HTML conversion edge cases. 5. Documentation (Low Priority)The function has minimal documentation. Recommendation: Add examples of the content priority logic and error conditions. Security and Performance
SummaryThis is a solid implementation that follows existing patterns well. The main actionable item is fixing the content priority order to match the UI. Testing would strengthen confidence, especially for the HTML conversion path. Verdict: Approve with suggestions for improvement. The current code is functional and safe to merge, but addressing the priority order inconsistency would improve user experience. |
Pull Request Review: Clipboard Copy FeatureOverviewThis PR adds clipboard copy functionality with the 'y' keybinding. The implementation follows existing code patterns and integrates well with the codebase architecture. ✅ Strengths
|
- Fix uninlined_format_args warnings by using inline variable formatting - Fix to_string_in_format_args warning by removing unnecessary to_string calls - Fix io_other_error warning by using std::io::Error::other - Fix needless_borrow and let_unit_value warnings - Remove trailing whitespace to satisfy rustfmt requirements - All code now follows Rust best practices and formatting standards
- Add cargo fmt to build commands documentation - Add guidance to run check, test, fmt and clippy before committing - Update Cargo.lock with latest dependency resolutions
Pull Request Review: Clipboard Copy FeatureI've reviewed PR #94 that adds clipboard copy functionality for messages. Here's my detailed feedback: ✅ Positive Aspects
🔍 Issues & Concerns1. Typo in CLAUDE.md (line 16)-Always run cargo check, test, fmt and clipy before committing.
+Always run cargo check, test, fmt and clippy before committing."clipy" should be "clippy" 2. Dependency Version Mismatch
This suggests the lock file was updated but the toml wasn't, or vice versa. For clarity and reproducibility, consider:
3. Large Dependency TreeThe Recommendations:
4. Missing TestsThe new #[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_copy_message_extracts_text_content() {
// Test text priority
// Test markdown fallback
// Test html conversion
// Test error case (no content)
}
}Note: Testing clipboard operations can be tricky, but you can at least test the content extraction logic by splitting it into a separate function. 5. Error Handling Could Be More User-FriendlyCurrently, clipboard errors are logged but not shown to the user. Consider:
6. HTML Conversion Edge Casehtml2text::from_read(html.as_bytes(), usize::MAX).unwrap_or_else(|_| html.clone())If HTML conversion fails, it falls back to raw HTML, which is not ideal for clipboard content. Consider:
7. Security ConsiderationWhen copying HTML-based messages, ensure that the conversion properly handles:
Consider setting a reasonable limit instead of 📋 Minor Code Quality Notes
🧪 Testing Recommendations
🎯 Recommendations SummaryMust Fix:
Should Fix:
Nice to Have:
Overall AssessmentThis is a solid feature addition that follows good coding practices and integrates well with the existing codebase. The main concerns are around testing coverage and the heavy dependency footprint. With the suggested improvements, particularly around testing and dependency optimization, this would be an excellent addition to the project. Recommendation: Approve with requested changes (primarily the typo fix and test coverage). |
- Add default target to list all available targets when running 'just' - Add check-all target that runs comprehensive quality checks in order - Add dedicated check target for cargo check - Improves developer experience and build workflow discoverability
Pull Request Review - feat: add clipboard copy for messagesThank you for this contribution! This PR addresses issue #56 and adds a useful feature for copying message content to the clipboard. Here's my detailed review: ✅ Strengths
🔍 Issues & Concerns1. Dependency Version Mismatch
|
- Fix dependency version mismatch: update arboard to 3.6 with disabled default features - Add comprehensive unit tests for message content extraction logic - Improve HTML conversion error handling with warning logs - Refactor copy logic into testable extract_message_content function - Reduce dependency tree by disabling unnecessary arboard image features - Fix clippy warnings for modern string interpolation format
Pull Request Review: Add Clipboard Copy for MessagesI've reviewed PR #94 which adds clipboard copy functionality with the 'y' keybinding. Here's my comprehensive feedback: ✅ Strengths
🔍 Code Quality Issues1. Missing feature flags for
|
Summary
yto copy selected message to clipboardFixes #56
Generated with Claude Code) • View branch • [View job run](https://github.com/sgrimee/webex-tui/actions/runs/18981063313