From ce988017f181fa8a37ba054bb63a307cdfed2415 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 11 Nov 2026 11:24:45 +0100 Subject: [PATCH] Add a test for pasting a wrapped commit message into the summary If you paste a commit message into the summary with the terminal's paste command, the body keeps its hard line breaks. This happens even where auto-wrapping would break the line at the same place. If you then edit a paragraph of the body, it doesn't reflow. Pasting with the commit menu already removes these line breaks. Co-Authored-By: Claude Opus 5.5 --- ...ne_commit_message_with_hard_line_breaks.go | 39 +++++++++++++++++++ pkg/integration/tests/test_list.go | 1 + 2 files changed, 40 insertions(+) create mode 100644 pkg/integration/tests/commit/paste_multi_line_commit_message_with_hard_line_breaks.go diff --git a/pkg/integration/tests/commit/paste_multi_line_commit_message_with_hard_line_breaks.go b/pkg/integration/tests/commit/paste_multi_line_commit_message_with_hard_line_breaks.go new file mode 100644 index 000000000..1c566cb7c --- /dev/null +++ b/pkg/integration/tests/commit/paste_multi_line_commit_message_with_hard_line_breaks.go @@ -0,0 +1,39 @@ +package commit + +import ( + "github.com/jesseduffield/lazygit/pkg/config" + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +var PasteMultiLineCommitMessageWithHardLineBreaks = NewIntegrationTest(NewIntegrationTestArgs{ + Description: "Paste a commit message whose body was wrapped at the auto-wrap width into the summary with the terminal's paste command, and check that the body reflows when editing it", + ExtraCmdArgs: []string{}, + Skip: false, + SetupConfig: func(config *config.AppConfig) {}, + SetupRepo: func(shell *Shell) { + shell.CreateFileAndAdd("file", "file content") + }, + Run: func(t *TestDriver, keys config.KeybindingConfig) { + t.Views().Files(). + Focus(). + Press(keys.Files.CommitChanges) + + t.ExpectPopup().CommitMessagePanel(). + Paste("subject\n\n" + + "The body of this commit was wrapped at the auto-wrap width when it was\n" + + "committed, so it contains a hard line break."). + Content(Equals("subject")) + + t.ExpectPopup().CommitDescriptionPanel(). + GoToBeginning(). + Type("Now "). + Content(Equals( + /* EXPECTED: + "Now The body of this commit was wrapped at the auto-wrap width when it \n" + + "was committed, so it contains a hard line break.")) + ACTUAL: */ + "Now The body of this commit was wrapped at the auto-wrap width when it \n" + + "was\n" + + "committed, so it contains a hard line break.")) + }, +}) diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go index 4a22b66f2..e5949856a 100644 --- a/pkg/integration/tests/test_list.go +++ b/pkg/integration/tests/test_list.go @@ -188,6 +188,7 @@ var tests = []*components.IntegrationTest{ commit.PasteCommitMessageWithHardLineBreaks, commit.PasteIntoCommitDescription, commit.PasteMultiLineCommitMessage, + commit.PasteMultiLineCommitMessageWithHardLineBreaks, commit.PreserveCommitMessage, commit.PreserveCommitMessageWhitespace, commit.ResetAuthor,