mirror of
https://github.com/Hopiu/micro.git
synced 2026-05-27 07:23:59 +00:00
Test suspend code
This commit is contained in:
parent
285503d009
commit
a70fb9db7d
2 changed files with 35 additions and 0 deletions
|
|
@ -837,6 +837,8 @@ func (v *View) Find(usePlugin bool) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (v *View) Suspend(usePlugin bool) bool { return false }
|
||||||
|
|
||||||
// FindNext searches forwards for the last used search term
|
// FindNext searches forwards for the last used search term
|
||||||
func (v *View) FindNext(usePlugin bool) bool {
|
func (v *View) FindNext(usePlugin bool) bool {
|
||||||
if usePlugin && !PreActionCall("FindNext", v) {
|
if usePlugin && !PreActionCall("FindNext", v) {
|
||||||
|
|
|
||||||
33
cmd/micro/actions_linux.go
Normal file
33
cmd/micro/actions_linux.go
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
func (v *View) Suspend(usePlugin bool) bool {
|
||||||
|
if usePlugin && !PreActionCall("Suspend", v) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
screenWasNil := screen == nil
|
||||||
|
|
||||||
|
if !screenWasNil {
|
||||||
|
screen.Fini()
|
||||||
|
screen = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// suspend the process
|
||||||
|
pid := syscall.Getpid()
|
||||||
|
tid := syscall.Gettid()
|
||||||
|
err := syscall.Tgkill(pid, tid, syscall.SIGSTOP)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !screenWasNil {
|
||||||
|
InitScreen()
|
||||||
|
}
|
||||||
|
|
||||||
|
if usePlugin {
|
||||||
|
return PostActionCall("Suspend", v)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue