diff options
-rwxr-xr-x | src/twopane.bash | 41 |
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() | |||
20 | BOT_SIZE=8 | 20 | BOT_SIZE=8 |
21 | BOT_TITLE=input | 21 | BOT_TITLE=input |
22 | 22 | ||
23 | DO_RESTART=y | ||
24 | DO_RESTART= | 23 | DO_RESTART= |
25 | DO_START= | 24 | DO_START= |
26 | DO_START=y | 25 | DO_START=y |
26 | DO_RESTART=y | ||
27 | 27 | ||
28 | if [ $# = 0 ] | 28 | if [ $# = 0 ] |
29 | then | 29 | then |
@@ -352,11 +352,7 @@ echo_sender() | |||
352 | 352 | ||
353 | restart_tty_forward() | 353 | restart_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 | ||
388 | restart() { attach "$@"; } | 383 | restart() { attach "$@"; } |
389 | start() { attach "$@"; } | 384 | start() { attach "$@"; } |
390 | foreground() { attach "$@"; } | 385 | foreground() { attach "$@"; } |
391 | |||
392 | twopane() { attach "$@"; } | 386 | twopane() { attach "$@"; } |
387 | forward() { attach "$@"; } | ||
393 | 388 | ||
394 | quit() | 389 | quit() |
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 | ||
455 | SIGINT() | 444 | SIGINT() |