summaryrefslogtreecommitdiffstats
path: root/src/tui
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-03-04 14:09:36 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-03-04 14:09:36 +0900
commit6fd4be580b65913299f2306998fc3f133c259fb2 (patch)
treef0bd653b7443e5a58db88370c570c90ef2a629e6 /src/tui
parent53348feb8959754497453232ffacd4bd3f1154ea (diff)
Use alternate screen only when the value of height is 100%
Do not automatically decide to use alternate screen when the value of height exceeds the height of the terminal. # Use alternate screen fzf fzf --height 100% fzf --no-height # Still use current screen fzf --height 10000
Diffstat (limited to 'src/tui')
-rw-r--r--src/tui/light.go19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/tui/light.go b/src/tui/light.go
index 2af31c4b..3f6985f5 100644
--- a/src/tui/light.go
+++ b/src/tui/light.go
@@ -107,7 +107,7 @@ type LightWindow struct {
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{
theme: theme,
forceBlack: forceBlack,
@@ -116,7 +116,7 @@ func NewLightRenderer(theme *ColorTheme, forceBlack bool, mouse bool, tabstop in
ttyin: openTtyIn(),
yoffset: 0,
tabstop: tabstop,
- fullscreen: false,
+ fullscreen: fullscreen,
upOneLine: false,
maxHeightFunc: maxHeightFunc}
return &r
@@ -176,11 +176,7 @@ func (r *LightRenderer) Init() {
}
r.origState = origState
terminal.MakeRaw(fd)
- terminalHeight, capHeight := r.updateTerminalSize()
- if capHeight == terminalHeight {
- r.fullscreen = true
- r.height = terminalHeight
- }
+ r.updateTerminalSize()
initTheme(r.theme, r.defaultTheme(), r.forceBlack)
if r.fullscreen {
@@ -242,20 +238,15 @@ func getEnv(name string, defaultValue int) int {
return atoi(env, defaultValue)
}
-func (r *LightRenderer) updateTerminalSize() (int, int) {
+func (r *LightRenderer) updateTerminalSize() {
width, height, err := terminal.GetSize(r.fd())
if err == nil {
r.width = width
- if r.fullscreen {
- r.height = height
- } else {
- r.height = r.maxHeightFunc(height)
- }
+ r.height = r.maxHeightFunc(height)
} else {
r.width = getEnv("COLUMNS", defaultWidth)
r.height = r.maxHeightFunc(getEnv("LINES", defaultHeight))
}
- return height, r.height
}
func (r *LightRenderer) getch(nonblock bool) (int, bool) {