Treatment of continua in the shell-model theory of nuclear reactions