handle ratios change at runtime

This commit is contained in:
Gokcehan 2016-12-18 22:38:28 +03:00
parent ee9d4c9ec4
commit 2085b6d797
2 changed files with 9 additions and 3 deletions

View File

@ -108,7 +108,7 @@ func (e *setExpr) eval(app *app, args []string) {
rats = append(rats, i) rats = append(rats, i)
} }
gOpts.ratios = rats gOpts.ratios = rats
app.ui = newUI() app.ui.wins = getWins()
app.ui.loadFile(app.nav) app.ui.loadFile(app.nav)
default: default:
msg := fmt.Sprintf("unknown option: %s", e.opt) msg := fmt.Sprintf("unknown option: %s", e.opt)

10
ui.go
View File

@ -361,7 +361,7 @@ func getWidths(wtot int) []int {
return widths return widths
} }
func newUI() *ui { func getWins() []*win {
wtot, htot := termbox.Size() wtot, htot := termbox.Size()
var wins []*win var wins []*win
@ -375,6 +375,12 @@ func newUI() *ui {
wacc += widths[i] wacc += widths[i]
} }
return wins
}
func newUI() *ui {
wtot, htot := termbox.Size()
key := make(chan string, 1000) key := make(chan string, 1000)
evs := make(chan termbox.Event) evs := make(chan termbox.Event)
@ -385,7 +391,7 @@ func newUI() *ui {
}() }()
return &ui{ return &ui{
wins: wins, wins: getWins(),
pwdwin: newWin(wtot, 1, 0, 0), pwdwin: newWin(wtot, 1, 0, 0),
msgwin: newWin(wtot, 1, 0, htot-1), msgwin: newWin(wtot, 1, 0, htot-1),
menuwin: newWin(wtot, 1, 0, htot-2), menuwin: newWin(wtot, 1, 0, htot-2),