Factored out logic to replace a line in the REPL.
Factored out logic to replace a line in the REPL.

cwi-swat/salix,cwi-swat/salix,cwi-swat/mondriaan,cwi-swat/mondriaan,cwi-swat/salix,cwi-swat/mondriaan