summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
authorRyooooooga <eial5q265e5@gmail.com>2022-08-18 23:05:30 +0900
committerRyooooooga <eial5q265e5@gmail.com>2022-08-18 23:39:15 +0900
commit3ada4dde12571d794a7415e4516e457961e01c45 (patch)
treead3307d0f80a7576d6bcb1930475531ea9a18f4c /pkg/gui
parentef82f394312e6f1c100f5153187d5537d701384f (diff)
fix: fix initial scroll position of edit box
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/confirmation_panel.go2
-rw-r--r--pkg/gui/view_helpers.go3
2 files changed, 4 insertions, 1 deletions
diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go
index 1ad724ad5..16bc551be 100644
--- a/pkg/gui/confirmation_panel.go
+++ b/pkg/gui/confirmation_panel.go
@@ -122,6 +122,7 @@ func (gui *Gui) prepareConfirmationPanel(
gui.Views.Confirmation.Wrap = !opts.Editable
gui.Views.Confirmation.FgColor = theme.GocuiDefaultTextColor
gui.Views.Confirmation.Mask = runeForMask(opts.Mask)
+ _ = gui.Views.Confirmation.SetOrigin(0, 0)
gui.findSuggestions = opts.FindSuggestionsFunc
if opts.FindSuggestionsFunc != nil {
@@ -133,6 +134,7 @@ func (gui *Gui) prepareConfirmationPanel(
suggestionsView.Title = fmt.Sprintf(gui.c.Tr.SuggestionsTitle, gui.c.UserConfig.Keybinding.Universal.TogglePanel)
}
+ gui.resizeConfirmationPanel()
return nil
}
diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go
index 40bc2fa02..713639251 100644
--- a/pkg/gui/view_helpers.go
+++ b/pkg/gui/view_helpers.go
@@ -87,7 +87,8 @@ func (gui *Gui) resizeConfirmationPanel() {
}
panelWidth := gui.getConfirmationPanelWidth()
prompt := gui.Views.Confirmation.Buffer()
- panelHeight := gui.getMessageHeight(true, prompt, panelWidth) + suggestionsViewHeight
+ wrap := !gui.Views.Confirmation.Editable
+ panelHeight := gui.getMessageHeight(wrap, prompt, panelWidth) + suggestionsViewHeight
x0, y0, x1, y1 := gui.getConfirmationPanelDimensionsAux(panelWidth, panelHeight)
confirmationViewBottom := y1 - suggestionsViewHeight
_, _ = gui.g.SetView(gui.Views.Confirmation.Name(), x0, y0, x1, confirmationViewBottom, 0)