summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/twopane.bash41
1 files changed, 15 insertions, 26 deletions
diff --git a/src/twopane.bash b/src/twopane.bash
index c266828..f3a15e1 100755
--- a/src/twopane.bash
+++ b/src/twopane.bash
@@ -20,10 +20,10 @@ kill_tty_forward()
20BOT_SIZE=8 20BOT_SIZE=8
21BOT_TITLE=input 21BOT_TITLE=input
22 22
23DO_RESTART=y
24DO_RESTART= 23DO_RESTART=
25DO_START= 24DO_START=
26DO_START=y 25DO_START=y
26DO_RESTART=y
27 27
28if [ $# = 0 ] 28if [ $# = 0 ]
29then 29then
@@ -352,11 +352,7 @@ echo_sender()
352 352
353restart_tty_forward() 353restart_tty_forward()
354{ 354{
355 { 355 detach
356 kill -INT %tty_forward
357 disown %tty_forward
358 } &>/dev/null
359
360 with_screen_pane 1 start_screen_pane "$@" 356 with_screen_pane 1 start_screen_pane "$@"
361 focus bottom 357 focus bottom
362 connect 358 connect
@@ -382,14 +378,13 @@ detach()
382 kill -INT %tty_forward 378 kill -INT %tty_forward
383 disown %tty_forward 379 disown %tty_forward
384 } &>/dev/null 380 } &>/dev/null
385 focus bottom
386} 381}
387 382
388restart() { attach "$@"; } 383restart() { attach "$@"; }
389start() { attach "$@"; } 384start() { attach "$@"; }
390foreground() { attach "$@"; } 385foreground() { attach "$@"; }
391
392twopane() { attach "$@"; } 386twopane() { attach "$@"; }
387forward() { attach "$@"; }
393 388
394quit() 389quit()
395{ 390{
@@ -426,30 +421,24 @@ prompt_command()
426 return 421 return
427 fi 422 fi
428 423
429 local job jobnew 424 local job
430 if job=$(jobs -n %tty_forward 2>/dev/null) 425 if ! { job=$(jobs %tty_forward 2>/dev/null) && [ "$job" ]; }
431 then
432 jobnew=y
433 else
434 job=$(jobs %tty_forward 2>/dev/null)
435 jobnew=
436 fi
437
438 if [ ! "$job" ]
439 then 426 then
440 finally 'start' : 427 finally 'start' :
441 return 428 return
442 fi 429 fi
443 430
444 if [ "$jobnew" ] 431 read _ jobstatus _ <<< "${job?Internal error: line $LINENO}"
445 then 432 case "${jobstatus?Internal error: line $LINENO}" in
446 read _ jobstatus _ <<< "$job" 433 Running )
447 if [ "$jobstatus" = 'Running' ]
448 then
449 jobs -x finally 'attach' kill -CONT %tty_forward 434 jobs -x finally 'attach' kill -CONT %tty_forward
450 fi 435 ;;
451 return 436 Terminated | Interrupt )
452 fi 437 finally 'start' :
438 ;;
439 Stopped )
440 ;;
441 esac
453} 442}
454 443
455SIGINT() 444SIGINT()