@ -107,7 +107,7 @@ type LightWindow struct {
bg Color
bg Color
}
}
func NewLightRenderer ( theme * ColorTheme , forceBlack bool , mouse bool , tabstop int , clearOnExit bool , maxHeightFunc func ( int ) int ) Renderer {
func NewLightRenderer ( theme * ColorTheme , forceBlack bool , mouse bool , tabstop int , clearOnExit bool , fullscreen bool , maxHeightFunc func ( int ) int ) Renderer {
r := LightRenderer {
r := LightRenderer {
theme : theme ,
theme : theme ,
forceBlack : forceBlack ,
forceBlack : forceBlack ,
@ -116,7 +116,7 @@ func NewLightRenderer(theme *ColorTheme, forceBlack bool, mouse bool, tabstop in
ttyin : openTtyIn ( ) ,
ttyin : openTtyIn ( ) ,
yoffset : 0 ,
yoffset : 0 ,
tabstop : tabstop ,
tabstop : tabstop ,
fullscreen : false ,
fullscreen : fullscreen ,
upOneLine : false ,
upOneLine : false ,
maxHeightFunc : maxHeightFunc }
maxHeightFunc : maxHeightFunc }
return & r
return & r
@ -176,11 +176,7 @@ func (r *LightRenderer) Init() {
}
}
r . origState = origState
r . origState = origState
terminal . MakeRaw ( fd )
terminal . MakeRaw ( fd )
terminalHeight , capHeight := r . updateTerminalSize ( )
r . updateTerminalSize ( )
if capHeight == terminalHeight {
r . fullscreen = true
r . height = terminalHeight
}
initTheme ( r . theme , r . defaultTheme ( ) , r . forceBlack )
initTheme ( r . theme , r . defaultTheme ( ) , r . forceBlack )
if r . fullscreen {
if r . fullscreen {
@ -242,20 +238,15 @@ func getEnv(name string, defaultValue int) int {
return atoi ( env , defaultValue )
return atoi ( env , defaultValue )
}
}
func ( r * LightRenderer ) updateTerminalSize ( ) (int , int ) {
func ( r * LightRenderer ) updateTerminalSize ( ) {
width , height , err := terminal . GetSize ( r . fd ( ) )
width , height , err := terminal . GetSize ( r . fd ( ) )
if err == nil {
if err == nil {
r . width = width
r . width = width
if r . fullscreen {
r . height = r . maxHeightFunc ( height )
r . height = height
} else {
r . height = r . maxHeightFunc ( height )
}
} else {
} else {
r . width = getEnv ( "COLUMNS" , defaultWidth )
r . width = getEnv ( "COLUMNS" , defaultWidth )
r . height = r . maxHeightFunc ( getEnv ( "LINES" , defaultHeight ) )
r . height = r . maxHeightFunc ( getEnv ( "LINES" , defaultHeight ) )
}
}
return height , r . height
}
}
func ( r * LightRenderer ) getch ( nonblock bool ) ( int , bool ) {
func ( r * LightRenderer ) getch ( nonblock bool ) ( int , bool ) {