diff --git a/pkg/commands/os.go b/pkg/commands/os.go index a64b286f4..7bd714157 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -85,6 +85,7 @@ func (c *OSCommand) RunCommandWithOutputLive(command string, output func(string) go func() { // Regex to cleanup the command output + // sometimes the output words include unneeded spaces at eatch end of the string re := regexp.MustCompile(`(^\s*)|(\s*$)`) scanner := bufio.NewScanner(tty) diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go index 39818a848..3f2225a7b 100644 --- a/pkg/gui/commit_message_panel.go +++ b/pkg/gui/commit_message_panel.go @@ -60,10 +60,11 @@ var waitForGroupActie = false func (gui *Gui) waitForPassUname(g *gocui.Gui, currentView *gocui.View, passOrUname string) string { waitForGroupActie = true waitForGroup.Add(1) + pushPassUnameView := gui.getPushPassUnameView(g) if passOrUname == "username" { pushPassUnameView.Title = gui.Tr.SLocalize("PushUsername") - // pushPassUnameView.Mask = 1 + pushPassUnameView.Mask = 0 } else { pushPassUnameView.Title = gui.Tr.SLocalize("PushPassword") pushPassUnameView.Mask = '*' @@ -80,15 +81,23 @@ func (gui *Gui) waitForPassUname(g *gocui.Gui, currentView *gocui.View, passOrUn gui.RenderCommitLength() return nil }) + + // wait for username/passwords input waitForGroup.Wait() return unamePassMessage } func (gui *Gui) handlePushConfirm(g *gocui.Gui, v *gocui.View) error { message := gui.trimmedContent(v) + if message == "" { + // make sure to input something + // if not dune the push progress will run forever + message = "-" + } unamePassMessage = message if waitForGroupActie { - defer waitForGroup.Done() + waitForGroup.Done() + waitForGroupActie = false } err := gui.refreshFiles(g) if err != nil { @@ -117,7 +126,8 @@ func (gui *Gui) handlePushClose(g *gocui.Gui, v *gocui.View) error { } unamePassMessage = "" if waitForGroupActie { - defer waitForGroup.Done() + waitForGroup.Done() + waitForGroupActie = false } return gui.switchFocus(g, v, gui.getFilesView(g)) } diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 8083c0e6a..ac5a8412e 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -364,6 +364,7 @@ func (gui *Gui) pushWithForceFlag(g *gocui.Gui, currentView *gocui.View, force b err := gui.GitCommand.Push(branchName, force, func(passOrUname string) string { return gui.waitForPassUname(g, currentView, passOrUname) }) + _, _ = g.SetViewOnBottom("pushPassUname") if err != nil { errMessage := err.Error() if errMessage == "exit status 128" {