X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=cmd%2Fmicro%2Ftab.go;h=b03736705d684809185a8d16ec4d77b2bd91c8cb;hb=ea6a87d41a9fcaa9fff81c1a5310726b1e15c548;hp=f750205e80405c056ec82d048f97330c7a0f1121;hpb=fb980bb695f17eee3ad4ae8e53d773da387be3d0;p=micro.git diff --git a/cmd/micro/tab.go b/cmd/micro/tab.go index f750205e..b0373670 100644 --- a/cmd/micro/tab.go +++ b/cmd/micro/tab.go @@ -8,6 +8,8 @@ import ( var tabBarOffset int +// A Tab holds an array of views and a splitTree to determine how the +// views should be arranged type Tab struct { // This contains all the views in this tab // There is generally only one view per tab, but you can have @@ -36,6 +38,9 @@ func NewTabFromView(v *View) *Tab { if globalSettings["infobar"].(bool) { t.tree.height-- } + if globalSettings["keymenu"].(bool) { + t.tree.height -= 2 + } t.Resize() @@ -50,10 +55,13 @@ func (t *Tab) SetNum(num int) { } } +// Cleanup cleans up the tree (for example if views have closed) func (t *Tab) Cleanup() { t.tree.Cleanup() } +// Resize handles a resize event from the terminal and resizes +// all child views correctly func (t *Tab) Resize() { w, h := screen.Size() t.tree.width = w @@ -62,11 +70,17 @@ func (t *Tab) Resize() { if globalSettings["infobar"].(bool) { t.tree.height-- } + if globalSettings["keymenu"].(bool) { + t.tree.height -= 2 + } t.tree.ResizeSplits() for i, v := range t.views { v.Num = i + if v.Type == vtTerm { + v.term.Resize(v.Width, v.Height) + } } }