Skip to content

Commit 5eddf5b

Browse files
authored
Change MainTab calls (zyedidia#3750)
Swaping `MainTab` calls to `h.tab` will not change the normal micro behaviour. This changes will make possible to call `ForceQuit`, `VSplitIndex` and `HSplitIndex` for tabs that aren't main one.
1 parent cd0dc9a commit 5eddf5b

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

internal/action/actions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,11 +1891,11 @@ func (h *BufPane) ClearInfo() bool {
18911891
return true
18921892
}
18931893

1894-
// ForceQuit closes the current tab or view even if there are unsaved changes
1894+
// ForceQuit closes the tab or view even if there are unsaved changes
18951895
// (no prompt)
18961896
func (h *BufPane) ForceQuit() bool {
18971897
h.Buf.Close()
1898-
if len(MainTab().Panes) > 1 {
1898+
if len(h.tab.Panes) > 1 {
18991899
h.Unsplit()
19001900
} else if len(Tabs.List) > 1 {
19011901
Tabs.RemoveTab(h.splitID)

internal/action/bufpane.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -652,28 +652,28 @@ func (h *BufPane) DoRuneInsert(r rune) {
652652
// VSplitIndex opens the given buffer in a vertical split on the given side.
653653
func (h *BufPane) VSplitIndex(buf *buffer.Buffer, right bool) *BufPane {
654654
e := NewBufPaneFromBuf(buf, h.tab)
655-
e.splitID = MainTab().GetNode(h.splitID).VSplit(right)
656-
currentPaneIdx := MainTab().GetPane(h.splitID)
655+
e.splitID = h.tab.GetNode(h.splitID).VSplit(right)
656+
currentPaneIdx := h.tab.GetPane(h.splitID)
657657
if right {
658658
currentPaneIdx++
659659
}
660-
MainTab().AddPane(e, currentPaneIdx)
661-
MainTab().Resize()
662-
MainTab().SetActive(currentPaneIdx)
660+
h.tab.AddPane(e, currentPaneIdx)
661+
h.tab.Resize()
662+
h.tab.SetActive(currentPaneIdx)
663663
return e
664664
}
665665

666666
// HSplitIndex opens the given buffer in a horizontal split on the given side.
667667
func (h *BufPane) HSplitIndex(buf *buffer.Buffer, bottom bool) *BufPane {
668668
e := NewBufPaneFromBuf(buf, h.tab)
669-
e.splitID = MainTab().GetNode(h.splitID).HSplit(bottom)
670-
currentPaneIdx := MainTab().GetPane(h.splitID)
669+
e.splitID = h.tab.GetNode(h.splitID).HSplit(bottom)
670+
currentPaneIdx := h.tab.GetPane(h.splitID)
671671
if bottom {
672672
currentPaneIdx++
673673
}
674-
MainTab().AddPane(e, currentPaneIdx)
675-
MainTab().Resize()
676-
MainTab().SetActive(currentPaneIdx)
674+
h.tab.AddPane(e, currentPaneIdx)
675+
h.tab.Resize()
676+
h.tab.SetActive(currentPaneIdx)
677677
return e
678678
}
679679

0 commit comments

Comments
 (0)