MCPcopy
hub / github.com/micro-editor/micro / openTerm

Method openTerm

internal/action/command.go:1135–1167  ·  view source on GitHub ↗
(args []string, newtab bool)

Source from the content-addressed store, hash-verified

1133}
1134
1135func (h *BufPane) openTerm(args []string, newtab bool) {
1136 t := new(shell.Terminal)
1137 err := t.Start(args, false, true, nil, nil)
1138 if err != nil {
1139 InfoBar.Error(err)
1140 return
1141 }
1142
1143 pane := 0
1144 id := h.ID()
1145 if newtab {
1146 h.AddTab()
1147 id = MainTab().Panes[pane].ID()
1148 } else {
1149 for i, p := range MainTab().Panes {
1150 if p.IsActive() {
1151 pane = i
1152 id = p.ID()
1153 p.Close()
1154 break
1155 }
1156 }
1157 }
1158
1159 v := h.GetView()
1160 tp, err := NewTermPane(v.X, v.Y, v.Width, v.Height, t, id, MainTab())
1161 if err != nil {
1162 InfoBar.Error(err)
1163 return
1164 }
1165 MainTab().Panes[pane] = tp
1166 MainTab().SetActive(pane)
1167}
1168
1169// TermCmd opens a terminal in the current view
1170func (h *BufPane) TermCmd(args []string) {

Callers 1

TermCmdMethod · 0.95

Calls 11

IDMethod · 0.95
AddTabMethod · 0.95
MainTabFunction · 0.85
NewTermPaneFunction · 0.85
IDMethod · 0.65
IsActiveMethod · 0.65
CloseMethod · 0.65
GetViewMethod · 0.65
SetActiveMethod · 0.65
StartMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected