1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-20 17:22:23 +03:00

Strip leading/trailing whitespace from prompt input

This doesn't really solve a pressing problem, because I guess it's unlikely that
users add spaces at the beginning or end of what they type into a prompt; but it
could happen, and in this case we almost always want to strip it. Just adding
this here for completeness while I was working on this code.

The only exception is the input prompt of custom commands, because who knows
what users want to use that input for in their custom command.
This commit is contained in:
Stefan Haller
2025-11-15 14:24:54 +01:00
parent d7e733cd56
commit 7c126cd2fc
5 changed files with 12 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ func (self *ShellCommandAction) Call() error {
Title: self.c.Tr.ShellCommand,
FindSuggestionsFunc: self.GetShellCommandsHistorySuggestionsFunc(),
AllowEditSuggestion: true,
PreserveWhitespace: true,
HandleConfirm: func(command string) error {
if self.shouldSaveCommand(command) {
self.c.GetAppState().ShellCommandsHistory = utils.Limit(