type TermType int
const (
- TTIdle = iota // Waiting for a new command
+ TTClose = iota // Should be closed
TTRunning // Currently running a command
TTDone // Finished running a command
)
return t.Selection[0] != t.Selection[1]
}
+func (t *Terminal) Name() string {
+ return t.title
+}
+
// GetSelection returns the selected text
func (t *Terminal) GetSelection(width int) string {
start := t.Selection[0]
}
// Start begins a new command in this terminal with a given view
-func (t *Terminal) Start(execCmd []string, getOutput bool) error {
+func (t *Terminal) Start(execCmd []string, getOutput bool, wait bool) error {
if len(execCmd) <= 0 {
return nil
}
t.getOutput = getOutput
t.Status = TTRunning
t.title = execCmd[0] + ":" + strconv.Itoa(cmd.Process.Pid)
+ t.wait = wait
go func() {
for {
}
screen.Redraw()
}
- // TODO: close Term
- // closeterm <- view.Num
+ t.Stop()
}()
return nil
}
}
-// Close sets the Status to TTIdle indicating that the terminal
-// is ready for a new command to execute
+// Close sets the Status to TTClose indicating that the terminal
+// is done and should be closed
func (t *Terminal) Close() {
- t.Status = TTIdle
+ t.Status = TTClose
// call the lua function that the user has given as a callback
if t.getOutput {
// TODO: plugin callback on Term emulator