Add copy and open-in-editor options to the command log menu#5714
Open
tmwatchanan wants to merge 5 commits into
Open
Add copy and open-in-editor options to the command log menu#5714tmwatchanan wants to merge 5 commits into
tmwatchanan wants to merge 5 commits into
Conversation
Hook and push output is easy to read in lazygit but hard to reuse elsewhere. Parse git output blocks from the command log view so copies match what is shown, include the action and command above each block, and avoid logging clipboard operations back into the stream.
Hook and linter output often uses leading spaces for stack traces and continuations. Those lines are visible in the log but were dropped on copy because every two-space-prefixed line was treated as lazygit log noise.
…output A non-indented error line followed by indented context matches the shape of an action plus command, so copied git output was truncated mid-block. Only treat the next line as a new log entry when it looks like a lazygit command rather than any indented text.
38bf25b to
799deab
Compare
Avoids awkward multi-line terminal copy when reusing log content elsewhere.
Evaluate menu disabled reasons when rendering and invoking so copy items update while the menu is open. Export actions and git output without panel chrome, match copy-notification lines via i18n log templates, and disable open-in-editor until there is real log content.
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.
PR Description
Git hook and push output is easy to read in lazygit's command log but difficult to copy, especially when the output spans multiple lines. Terminal selection is awkward and often picks up neighbouring panels. Related discussion: #3031, including this suggestion to open log output in
$EDITOR.This adds three entries to the command log menu (
@):c)a)o) — writes the full log to a temp file and opens it in the configured editor.Copy items include the lazygit action, the indented
gitcommand(s) above the block, and everything underGit output:. The editor export uses the same underlying log content, without panel chrome or copy-notification lines.Implementation notes:
CopyToClipboardQuietso writing to the clipboard is not logged back into the command log stream.LastGitOutput()andAllGitOutput()onIGuiCommonfor custom commands.Please check if the PR fulfills these requirements
go generate ./...)