mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
Add ability to force portrait mode
A new gui config flag 'portraitMode':<string> is added to influence when LazyGit stacks its UI components on top of one another. The accepted values are 'auto', 'always', 'never'. 'auto': enter portrait mode when terminal becomes narrow enough 'always': always use portrait mode unconditional of the terminal dimensions 'never': never use portraid mode Signed-off-by: Louis DeLosSantos <louis.delos@gmail.com>
This commit is contained in:
committed by
Stefan Haller
parent
4f3127ccb8
commit
9c72d8a2b0
@ -34,14 +34,24 @@ func NewWindowArrangementHelper(
|
||||
|
||||
const INFO_SECTION_PADDING = " "
|
||||
|
||||
func (self *WindowArrangementHelper) shouldUsePortraitMode(width, height int) bool {
|
||||
switch self.c.UserConfig.Gui.PortraitMode {
|
||||
case "never":
|
||||
return false
|
||||
case "always":
|
||||
return true
|
||||
default: // "auto" or any garbage values in PortraitMode value
|
||||
return width <= 84 && height > 45
|
||||
}
|
||||
}
|
||||
|
||||
func (self *WindowArrangementHelper) GetWindowDimensions(informationStr string, appStatus string) map[string]boxlayout.Dimensions {
|
||||
width, height := self.c.GocuiGui().Size()
|
||||
|
||||
sideSectionWeight, mainSectionWeight := self.getMidSectionWeights()
|
||||
|
||||
sidePanelsDirection := boxlayout.COLUMN
|
||||
portraitMode := width <= 84 && height > 45
|
||||
if portraitMode {
|
||||
if self.shouldUsePortraitMode(width, height) {
|
||||
sidePanelsDirection = boxlayout.ROW
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user