private void restoreTerminal(TerminalStatus status) {
    // Signal handlers
    terminal.handle(Terminal.Signal.INT, status.handlerInt);
    terminal.handle(Terminal.Signal.QUIT, status.handlerQuit);
    terminal.handle(Terminal.Signal.TSTP, status.handlerTstp);
    terminal.handle(Terminal.Signal.CONT, status.handlerCont);
    terminal.handle(Terminal.Signal.WINCH, status.handlerWinch);

    // Attributes
    terminal.setAttributes(status.attributes);

    // Capability
    terminal.puts(InfoCmp.Capability.exit_ca_mode);
    terminal.puts(InfoCmp.Capability.cursor_visible);
  }
A scrolling (logging) view of the query result of a streaming SELECT statement.
samza-sql-shell/src/main/java/org/apache/samza/sql/client/cli/QueryResultLogView.java