Make the repl interaction functions work correctly in edge cases

- Different behavior depending on single/multiple lines of input
  and input source being region or shm-current-node