mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-23 22:24:51 +02:00
Add PagerConfig
This is an object that is owned by Gui, is accessible through GuiCommon.State(), and also passed down to GitCommand, where it is mostly needed. Right now it simply wraps access to the Git.Paging config, which isn't very exciting, but we'll extend it in the next commit to handle a slice of pagers (and maintain the currently selected pager index), and doing this refactoring up front allows us to make that change without having to touch clients.
This commit is contained in:
@@ -45,8 +45,8 @@ func (gui *Gui) onResize() error {
|
||||
// command.
|
||||
func (gui *Gui) newPtyTask(view *gocui.View, cmd *exec.Cmd, prefix string) error {
|
||||
width := view.InnerWidth()
|
||||
pager := gui.git.Config.GetPager(width)
|
||||
externalDiffCommand := gui.Config.GetUserConfig().Git.Paging.ExternalDiffCommand
|
||||
pager := gui.stateAccessor.GetPagerConfig().GetPagerCommand(width)
|
||||
externalDiffCommand := gui.stateAccessor.GetPagerConfig().GetExternalDiffCommand()
|
||||
|
||||
if pager == "" && externalDiffCommand == "" {
|
||||
// if we're not using a custom pager we don't need to use a pty
|
||||
@@ -58,7 +58,7 @@ func (gui *Gui) newPtyTask(view *gocui.View, cmd *exec.Cmd, prefix string) error
|
||||
// Need to get the width and the pager again because the layout might have
|
||||
// changed the size of the view
|
||||
width = view.InnerWidth()
|
||||
pager = gui.git.Config.GetPager(width)
|
||||
pager := gui.stateAccessor.GetPagerConfig().GetPagerCommand(width)
|
||||
|
||||
cmdStr := strings.Join(cmd.Args, " ")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user