mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 20:36:03 +02:00
Run PTY tasks after layout so that they get the correct view size
This is important when using a pager that draws a horizontal line across the entire width of the view; when changing from a file or directory that has only unstaged (or only staged) changes to one that has both, the main view is split in half, but the PTY task would be run on the view in its old state, so the horizonal line would be too long and wrap around.
This commit is contained in:
parent
f98da780de
commit
8b8343b8a9
3 changed files with 14 additions and 7 deletions
|
@ -959,3 +959,12 @@ func (gui *Gui) onWorker(f func(gocui.Task) error) {
|
||||||
func (gui *Gui) getWindowDimensions(informationStr string, appStatus string) map[string]boxlayout.Dimensions {
|
func (gui *Gui) getWindowDimensions(informationStr string, appStatus string) map[string]boxlayout.Dimensions {
|
||||||
return gui.helpers.WindowArrangement.GetWindowDimensions(informationStr, appStatus)
|
return gui.helpers.WindowArrangement.GetWindowDimensions(informationStr, appStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gui *Gui) afterLayout(f func() error) {
|
||||||
|
select {
|
||||||
|
case gui.afterLayoutFuncs <- f:
|
||||||
|
default:
|
||||||
|
// hopefully this never happens
|
||||||
|
gui.c.Log.Error("afterLayoutFuncs channel is full, skipping function")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -189,12 +189,7 @@ func (self *guiCommon) GetInitialKeybindingsWithCustomCommands() ([]*types.Bindi
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *guiCommon) AfterLayout(f func() error) {
|
func (self *guiCommon) AfterLayout(f func() error) {
|
||||||
select {
|
self.gui.afterLayout(f)
|
||||||
case self.gui.afterLayoutFuncs <- f:
|
|
||||||
default:
|
|
||||||
// hopefully this never happens
|
|
||||||
self.gui.c.Log.Error("afterLayoutFuncs channel is full, skipping function")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *guiCommon) RunningIntegrationTest() bool {
|
func (self *guiCommon) RunningIntegrationTest() bool {
|
||||||
|
|
|
@ -20,7 +20,10 @@ func (gui *Gui) runTaskForView(view *gocui.View, task types.UpdateTask) error {
|
||||||
return gui.newCmdTask(view, v.Cmd, v.Prefix)
|
return gui.newCmdTask(view, v.Cmd, v.Prefix)
|
||||||
|
|
||||||
case *types.RunPtyTask:
|
case *types.RunPtyTask:
|
||||||
return gui.newPtyTask(view, v.Cmd, v.Prefix)
|
gui.afterLayout(func() error {
|
||||||
|
return gui.newPtyTask(view, v.Cmd, v.Prefix)
|
||||||
|
})
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue