| 1133 | } |
| 1134 | |
| 1135 | func (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 |
| 1170 | func (h *BufPane) TermCmd(args []string) { |