mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-12 15:53:33 -04:00
Remove hard line breaks from text pasted into the commit description
Do the same as when pasting a commit message with the commit menu, so that the paragraphs of the body reflow when you edit them. This also covers a commit message pasted into the summary, since everything after its first line goes into the description. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ce988017f1
commit
ebbd2126db
@@ -346,7 +346,11 @@ func (self *CommitsHelper) HandlePasteIntoDescription(text string) {
|
||||
// pastes a whole commit message into the summary
|
||||
text = strings.TrimLeft(text, "\n")
|
||||
}
|
||||
view.TextArea.TypeString(replaceTabsInPastedText(text))
|
||||
// Remove the hard line breaks of the pasted text on its own, even if it
|
||||
// goes into the middle of a line. Its line breaks come from the layout of
|
||||
// the text that it was copied from, not from the line that it goes into.
|
||||
text = self.TryRemoveHardLineBreaksIfAutoWrapping(replaceTabsInPastedText(text))
|
||||
view.TextArea.TypeString(text)
|
||||
view.RenderTextArea()
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,7 @@ var PasteMultiLineCommitMessageWithHardLineBreaks = NewIntegrationTest(NewIntegr
|
||||
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."))
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user