mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-12 15:53:33 -04:00
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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fb21a99035
commit
ce988017f1
@@ -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."))
|
||||
},
|
||||
})
|
||||
@@ -188,6 +188,7 @@ var tests = []*components.IntegrationTest{
|
||||
commit.PasteCommitMessageWithHardLineBreaks,
|
||||
commit.PasteIntoCommitDescription,
|
||||
commit.PasteMultiLineCommitMessage,
|
||||
commit.PasteMultiLineCommitMessageWithHardLineBreaks,
|
||||
commit.PreserveCommitMessage,
|
||||
commit.PreserveCommitMessageWhitespace,
|
||||
commit.ResetAuthor,
|
||||
|
||||
Reference in New Issue
Block a user