summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gopkg.lock5
-rw-r--r--pkg/gui/commit_message_panel.go9
-rw-r--r--pkg/gui/confirmation_panel.go15
-rw-r--r--pkg/gui/gui.go12
-rw-r--r--pkg/gui/view_helpers.go22
-rw-r--r--vendor/github.com/jesseduffield/gocui/edit.go2
6 files changed, 26 insertions, 39 deletions
diff --git a/Gopkg.lock b/Gopkg.lock
index e0df88b2d..73c8c3731 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -189,11 +189,11 @@
[[projects]]
branch = "master"
- digest = "1:acbcdae312c37a8019e0f573a9be26499058d5e1244243655373d2fd97714658"
+ digest = "1:145fe566d21b0e2579e1600f09e4e4b01da017676ba8e079de75a2e21111538b"
name = "github.com/jesseduffield/gocui"
packages = ["."]
pruneopts = "NUT"
- revision = "5d9e836837237cb3aadca51ecb37c7cf3345bfa4"
+ revision = "c4051ef0fbcbe519bc1d082a579a38100c7cf044"
[[projects]]
digest = "1:ac6d01547ec4f7f673311b4663909269bfb8249952de3279799289467837c3cc"
@@ -611,7 +611,6 @@
analyzer-version = 1
input-imports = [
"github.com/cloudfoundry/jibber_jabber",
- "github.com/davecgh/go-spew/spew",
"github.com/fatih/color",
"github.com/golang-collections/collections/stack",
"github.com/heroku/rollrus",
diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go
index 26db703f0..36718680f 100644
--- a/pkg/gui/commit_message_panel.go
+++ b/pkg/gui/commit_message_panel.go
@@ -34,15 +34,6 @@ func (gui *Gui) handleCommitClose(g *gocui.Gui, v *gocui.View) error {
}
func (gui *Gui) handleNewlineCommitMessage(g *gocui.Gui, v *gocui.View) error {
- // resising ahead of time so that the top line doesn't get hidden to make
- // room for the cursor on the second line
- x0, y0, x1, y1 := gui.getConfirmationPanelDimensions(g, v.Buffer())
- if _, err := g.SetView("commitMessage", x0, y0, x1, y1+1, 0); err != nil {
- if err != gocui.ErrUnknownView {
- return err
- }
- }
-
v.EditNewLine()
return nil
}
diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go
index 1702b1df6..0bb633f32 100644
--- a/pkg/gui/confirmation_panel.go
+++ b/pkg/gui/confirmation_panel.go
@@ -11,7 +11,6 @@ import (
"github.com/fatih/color"
"github.com/jesseduffield/gocui"
- "github.com/jesseduffield/lazygit/pkg/utils"
)
func (gui *Gui) wrappedConfirmationFunction(function func(*gocui.Gui, *gocui.View) error) func(*gocui.Gui, *gocui.View) error {
@@ -161,17 +160,3 @@ func (gui *Gui) createErrorPanel(g *gocui.Gui, message string) error {
coloredMessage := colorFunction(strings.TrimSpace(message))
return gui.createConfirmationPanel(g, currentView, gui.Tr.SLocalize("Error"), coloredMessage, nil, nil)
}
-
-func (gui *Gui) resizePopupPanel(g *gocui.Gui, v *gocui.View) error {
- // If the confirmation panel is already displayed, just resize the width,
- // otherwise continue
- content := utils.TrimTrailingNewline(v.Buffer())
- x0, y0, x1, y1 := gui.getConfirmationPanelDimensions(g, content)
- vx0, vy0, vx1, vy1 := v.Dimensions()
- if vx0 == x0 && vy0 == y0 && vx1 == x1 && vy1 == y1 {
- return nil
- }
- gui.Log.Info(gui.Tr.SLocalize("resizingPopupPanel"))
- _, err := g.SetView(v.Name(), x0, y0, x1, y1, 0)
- return err
-}
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 2a68bce71..bb2ed752b 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -307,9 +307,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
}
}
- gui.resizePopupPanels(g)
-
- return nil
+ return gui.resizeCurrentPopupPanel(g)
}
func (gui *Gui) promptAnonymousReporting() error {
@@ -355,14 +353,6 @@ func (gui *Gui) goEvery(g *gocui.Gui, interval time.Duration, function func(*goc
}()
}
-func (gui *Gui) resizePopupPanels(g *gocui.Gui) error {
- v := g.CurrentView()
- if v.Name() == "commitMessage" || v.Name() == "confirmation" {
- return gui.resizePopupPanel(g, v)
- }
- return nil
-}
-
// Run setup the gui with keybindings and start the mainloop
func (gui *Gui) Run() error {
g, err := gocui.NewGui(gocui.OutputNormal, OverlappingEdges)
diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go
index fd810220b..3a59945a5 100644
--- a/pkg/gui/view_helpers.go
+++ b/pkg/gui/view_helpers.go
@@ -268,3 +268,25 @@ func (gui *Gui) currentViewName(g *gocui.Gui) string {
currentView := g.CurrentView()
return currentView.Name()
}
+
+func (gui *Gui) resizeCurrentPopupPanel(g *gocui.Gui) error {
+ v := g.CurrentView()
+ if v.Name() == "commitMessage" || v.Name() == "confirmation" {
+ return gui.resizePopupPanel(g, v)
+ }
+ return nil
+}
+
+func (gui *Gui) resizePopupPanel(g *gocui.Gui, v *gocui.View) error {
+ // If the confirmation panel is already displayed, just resize the width,
+ // otherwise continue
+ content := v.Buffer()
+ x0, y0, x1, y1 := gui.getConfirmationPanelDimensions(g, content)
+ vx0, vy0, vx1, vy1 := v.Dimensions()
+ if vx0 == x0 && vy0 == y0 && vx1 == x1 && vy1 == y1 {
+ return nil
+ }
+ gui.Log.Info(gui.Tr.SLocalize("resizingPopupPanel"))
+ _, err := g.SetView(v.Name(), x0, y0, x1, y1, 0)
+ return err
+}
diff --git a/vendor/github.com/jesseduffield/gocui/edit.go b/vendor/github.com/jesseduffield/gocui/edit.go
index a5e6f690b..c339d75fb 100644
--- a/vendor/github.com/jesseduffield/gocui/edit.go
+++ b/vendor/github.com/jesseduffield/gocui/edit.go
@@ -114,8 +114,8 @@ func (v *View) EditDelete(back bool) {
func (v *View) EditNewLine() {
v.breakLine(v.cx, v.cy)
v.ox = 0
+ v.cy = v.cy + 1
v.cx = 0
- v.MoveCursor(0, 1, true)
}
// MoveCursor moves the cursor taking into account the width of the line/view,