mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-05 00:59:19 +02:00
allow showing, hiding, and scrolling the extras panel
This commit is contained in:
@ -156,6 +156,7 @@ type KeybindingUniversalConfig struct {
|
|||||||
CopyToClipboard string `yaml:"copyToClipboard"`
|
CopyToClipboard string `yaml:"copyToClipboard"`
|
||||||
SubmitEditorText string `yaml:"submitEditorText"`
|
SubmitEditorText string `yaml:"submitEditorText"`
|
||||||
AppendNewline string `yaml:"appendNewline"`
|
AppendNewline string `yaml:"appendNewline"`
|
||||||
|
ExtrasMenu string `yaml:"extrasMenu"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type KeybindingStatusConfig struct {
|
type KeybindingStatusConfig struct {
|
||||||
@ -383,6 +384,7 @@ func GetDefaultConfig() *UserConfig {
|
|||||||
CopyToClipboard: "<c-o>",
|
CopyToClipboard: "<c-o>",
|
||||||
SubmitEditorText: "<enter>",
|
SubmitEditorText: "<enter>",
|
||||||
AppendNewline: "<a-enter>",
|
AppendNewline: "<a-enter>",
|
||||||
|
ExtrasMenu: "@",
|
||||||
},
|
},
|
||||||
Status: KeybindingStatusConfig{
|
Status: KeybindingStatusConfig{
|
||||||
CheckForUpdate: "u",
|
CheckForUpdate: "u",
|
||||||
|
@ -146,7 +146,10 @@ func (gui *Gui) getWindowDimensions(informationStr string, appStatus string) map
|
|||||||
mainPanelsDirection = boxlayout.COLUMN
|
mainPanelsDirection = boxlayout.COLUMN
|
||||||
}
|
}
|
||||||
|
|
||||||
extrasWindowSize := 40 // TODO: make configurable
|
extrasWindowSize := 0
|
||||||
|
if gui.ShowExtrasWindow {
|
||||||
|
extrasWindowSize = 40 // TODO: make configurable
|
||||||
|
}
|
||||||
|
|
||||||
root := &boxlayout.Box{
|
root := &boxlayout.Box{
|
||||||
Direction: boxlayout.ROW,
|
Direction: boxlayout.ROW,
|
||||||
|
15
pkg/gui/extras_panel.go
Normal file
15
pkg/gui/extras_panel.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package gui
|
||||||
|
|
||||||
|
func (gui *Gui) handleCreateExtrasMenuPanel() error {
|
||||||
|
menuItems := []*menuItem{
|
||||||
|
{
|
||||||
|
displayString: "Toggle show/hide command log",
|
||||||
|
onPress: func() error {
|
||||||
|
gui.ShowExtrasWindow = !gui.ShowExtrasWindow
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return gui.createMenu(gui.Tr.DiffingMenuTitle, menuItems, createMenuOptions{showCancel: true})
|
||||||
|
}
|
@ -113,7 +113,7 @@ func (gui *Gui) linesToScrollDown(view *gocui.View) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) atScrollBottom(view *gocui.View) bool {
|
func (gui *Gui) atScrollBottom(view *gocui.View) bool {
|
||||||
return gui.linesToScrollDown(view) > 0
|
return gui.linesToScrollDown(view) == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) scrollUpMain() error {
|
func (gui *Gui) scrollUpMain() error {
|
||||||
@ -147,14 +147,14 @@ func (gui *Gui) scrollUpExtra() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) scrollDownExtra() error {
|
func (gui *Gui) scrollDownExtra() error {
|
||||||
if err := gui.scrollDownView(gui.Views.Extras); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if gui.atScrollBottom(gui.Views.Extras) {
|
if gui.atScrollBottom(gui.Views.Extras) {
|
||||||
gui.Views.Extras.Autoscroll = true
|
gui.Views.Extras.Autoscroll = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := gui.scrollDownView(gui.Views.Extras); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,6 +113,9 @@ type Gui struct {
|
|||||||
// Log of the commands that get run, to be displayed to the user.
|
// Log of the commands that get run, to be displayed to the user.
|
||||||
CmdLog []string
|
CmdLog []string
|
||||||
OnRunCommand func(entry oscommands.CmdLogEntry)
|
OnRunCommand func(entry oscommands.CmdLogEntry)
|
||||||
|
|
||||||
|
// the extras window contains things like the command log
|
||||||
|
ShowExtrasWindow bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type listPanelState struct {
|
type listPanelState struct {
|
||||||
@ -338,7 +341,6 @@ type guiState struct {
|
|||||||
IsRefreshingFiles bool
|
IsRefreshingFiles bool
|
||||||
Searching searchingState
|
Searching searchingState
|
||||||
ScreenMode WindowMaximisation
|
ScreenMode WindowMaximisation
|
||||||
SideView *gocui.View
|
|
||||||
Ptmx *os.File
|
Ptmx *os.File
|
||||||
PrevMainWidth int
|
PrevMainWidth int
|
||||||
PrevMainHeight int
|
PrevMainHeight int
|
||||||
@ -428,7 +430,6 @@ func (gui *Gui) resetState(filterPath string, reuseState bool) {
|
|||||||
ConflictsMutex: sync.Mutex{},
|
ConflictsMutex: sync.Mutex{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
SideView: nil,
|
|
||||||
Ptmx: nil,
|
Ptmx: nil,
|
||||||
Modes: Modes{
|
Modes: Modes{
|
||||||
Filtering: filtering.NewFiltering(filterPath),
|
Filtering: filtering.NewFiltering(filterPath),
|
||||||
|
@ -1111,6 +1111,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
|||||||
Description: gui.Tr.LcOpenDiffingMenu,
|
Description: gui.Tr.LcOpenDiffingMenu,
|
||||||
OpensMenu: true,
|
OpensMenu: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ViewName: "",
|
||||||
|
Key: gui.getKey(config.Universal.ExtrasMenu),
|
||||||
|
Handler: gui.handleCreateExtrasMenuPanel,
|
||||||
|
Description: gui.Tr.LcOpenExtrasMenu,
|
||||||
|
OpensMenu: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ViewName: "secondary",
|
ViewName: "secondary",
|
||||||
Key: gocui.MouseWheelUp,
|
Key: gocui.MouseWheelUp,
|
||||||
|
@ -386,6 +386,7 @@ type TranslationSet struct {
|
|||||||
DiffingMenuTitle string
|
DiffingMenuTitle string
|
||||||
LcSwapDiff string
|
LcSwapDiff string
|
||||||
LcOpenDiffingMenu string
|
LcOpenDiffingMenu string
|
||||||
|
LcOpenExtrasMenu string
|
||||||
LcShowingGitDiff string
|
LcShowingGitDiff string
|
||||||
LcCopyCommitShaToClipboard string
|
LcCopyCommitShaToClipboard string
|
||||||
LcCopyCommitMessageToClipboard string
|
LcCopyCommitMessageToClipboard string
|
||||||
@ -1038,6 +1039,8 @@ func englishTranslationSet() TranslationSet {
|
|||||||
DiffingMenuTitle: "Diffing",
|
DiffingMenuTitle: "Diffing",
|
||||||
LcSwapDiff: "reverse diff direction",
|
LcSwapDiff: "reverse diff direction",
|
||||||
LcOpenDiffingMenu: "open diff menu",
|
LcOpenDiffingMenu: "open diff menu",
|
||||||
|
// the actual view is the extras view which I intend to give more tabs in future but for now we'll only mention the command log part
|
||||||
|
LcOpenExtrasMenu: "open command log menu",
|
||||||
LcShowingGitDiff: "showing output for:",
|
LcShowingGitDiff: "showing output for:",
|
||||||
LcCopyCommitShaToClipboard: "copy commit SHA to clipboard",
|
LcCopyCommitShaToClipboard: "copy commit SHA to clipboard",
|
||||||
LcCopyCommitMessageToClipboard: "copy commit message to clipboard",
|
LcCopyCommitMessageToClipboard: "copy commit message to clipboard",
|
||||||
|
Reference in New Issue
Block a user