Add clipboard copy for log message and full entry (ctrl+y / y)#145
Open
soy-chrislo wants to merge 1 commit into
Open
Add clipboard copy for log message and full entry (ctrl+y / y)#145soy-chrislo wants to merge 1 commit into
soy-chrislo wants to merge 1 commit into
Conversation
In the log details modal, "y" (or "alt+y") copies just the log message, and "ctrl+y" copies the full entry as plain text (severity, timestamps, attributes, and the AI analysis if one has been run), suitable for pasting into Slack or an AI chat. This follows the design agreed on in the issue thread (atotto/clipboard, ctrl-y for the full log, y/alt-y for the message). Copying the AI analysis is folded into ctrl+y instead of a separate binding, since the analysis result already lives in the same info pane as the log details - happy to split it into its own key if maintainers prefer. Fixes control-theory#9
Author
|
Hope this resolves the issue! Happy to make any changes needed to get it merged — just let me know and I'll get on it. One small heads-up from testing: on my machine, pasting into Kate (KDE) specifically doesn't pick up the multi-line |
Contributor
|
Thanks for the PR and heads up - we'll take a look ! |
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.
Fixes #9
What
In the log details modal:
y(oralt+y) copies just the log message to the clipboard.ctrl+ycopies the full entry as plain text: severity, timestamps, attributes (sorted alphabetically, same as the attributes table), and the AI analysis result if one has already been run for this entry.Both are plain text (no ANSI/lipgloss styling), so they paste cleanly into Slack, an AI chat, or a bug report — matching the use case described in the issue.
Design
This follows what was discussed in the issue thread:
atotto/clipboard(it was already an indirect dependency, now promoted to direct viago mod tidy),ctrl-yfor the full log,y/alt-yfor the message.One deliberate deviation worth flagging: instead of adding a separate binding for "copy AI analysis" in the chat pane, I folded it into
ctrl+y— the AI analysis already renders in the same info pane as the rest of the log details, so copying "everything visible here" felt like the more natural fit. Happy to split it into its own key if you'd rather keep it separate.I intentionally left the chat pane untouched — it captures every keystroke while focused for typing, and scoping this to the info pane kept the change small and avoided fighting that input-focus behavior.
Testing
internal/tui/clipboard_test.go(table-driven, matching the only existing test file's style) covering the plain-text formatting (attribute sorting, optional Log Time/Attributes/AI Analysis sections, and skipping the transient "Analyzing..." placeholder).make fmt,make vet,make test,make buildall pass locally.wl-paste.Known limitation:
atotto/clipboardneedsxclip/xsel/wl-copyon Linux (no OSC52 fallback) — on failure, the status bar shows "Copy failed: ..." instead of silently doing nothing.