mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-07 15:40:24 +09:00
Test suspend code
This commit is contained in:
@@ -837,6 +837,8 @@ func (v *View) Find(usePlugin bool) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (v *View) Suspend(usePlugin bool) bool { return false }
|
||||
|
||||
// FindNext searches forwards for the last used search term
|
||||
func (v *View) FindNext(usePlugin bool) bool {
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user