reinit focus

This commit is contained in:
sawka 2023-01-11 20:53:46 -08:00
parent aa56db0bc4
commit be978a25b2
2 changed files with 13 additions and 1 deletions

View File

@ -444,7 +444,11 @@ func main() {
err = sstore.HangupAllRunningCmds(context.Background())
if err != nil {
log.Printf("[error] calling HUP on all running commands\n")
log.Printf("[error] calling HUP on all running commands: %v\n", err)
}
err = sstore.ReInitFocus(context.Background())
if err != nil {
log.Printf("[error] resetting window focus: %v\n", err)
}
go stdinReadWatch()

View File

@ -784,6 +784,14 @@ func AppendCmdErrorPk(ctx context.Context, errPk *packet.CmdErrorPacketType) err
})
}
func ReInitFocus(ctx context.Context) error {
return WithTx(ctx, func(tx *TxWrap) error {
query := `UPDATE screen_window SET focustype = 'input'`
tx.ExecWrap(query)
return nil
})
}
func HangupAllRunningCmds(ctx context.Context) error {
return WithTx(ctx, func(tx *TxWrap) error {
query := `UPDATE cmd SET status = ? WHERE status = ?`