2018-08-27 22:53:10 +03:00
|
|
|
// +build linux darwin dragonfly solaris openbsd netbsd freebsd
|
|
|
|
|
2018-08-28 02:53:08 +03:00
|
|
|
package action
|
2018-08-27 22:53:10 +03:00
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
|
|
|
|
2020-05-04 17:16:15 +03:00
|
|
|
"github.com/zyedidia/micro/v2/internal/screen"
|
2018-08-27 22:53:10 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// Suspend sends micro to the background. This is the same as pressing CtrlZ in most unix programs.
|
|
|
|
// This only works on linux and has no default binding.
|
|
|
|
// This code was adapted from the suspend code in nsf/godit
|
2019-01-19 23:37:59 +03:00
|
|
|
func (*BufPane) Suspend() bool {
|
2019-01-11 00:37:05 +03:00
|
|
|
screenb := screen.TempFini()
|
2018-08-27 22:53:10 +03:00
|
|
|
|
|
|
|
// suspend the process
|
|
|
|
pid := syscall.Getpid()
|
|
|
|
err := syscall.Kill(pid, syscall.SIGSTOP)
|
|
|
|
if err != nil {
|
2019-01-14 05:06:58 +03:00
|
|
|
screen.TermMessage(err)
|
2018-08-27 22:53:10 +03:00
|
|
|
}
|
|
|
|
|
2019-01-11 00:37:05 +03:00
|
|
|
screen.TempStart(screenb)
|
2018-08-27 22:53:10 +03:00
|
|
|
|
|
|
|
return false
|
|
|
|
}
|