private void loopForWriter() { try { while (isRunning) { final int c = socketReader.read(); if (c == EOF) { break; } if (c == EOT) { hackingForReDrawPrompt(); console.setPrompt(DEFAULT_PROMPT); console.redrawLine(); } else { out.write(c); } out.flush(); } } catch (IOException e) { err("write fail : %s", e.getMessage()); shutdown(); } }
private void abort() throws IOException { beep(); buf.clear(); println(); redrawLine(); }
redrawLine(); setBuffer(buffer);
/** * Possible states in which the current readline operation may be in. */ private static enum State { /** * The user is just typing away */ NORMAL, /** * In the middle of a emacs seach */ SEARCH, FORWARD_SEARCH, /** * VI "yank-to" operation ("y" during move mode) */ VI_YANK_TO, /** * VI "delete-to" operation ("d" during move mode) */ VI_DELETE_TO, /** * VI "change-to" operation ("c" during move mode) */ VI_CHANGE_TO }
void printLine( String line ) throws IOException { console.redrawLine(); console.print( line ); console.flush(); } }
private synchronized static void println(ConsoleReader in, String text) throws IOException { in.printString("\r"); in.printString(text + "\n"); in.redrawLine(); in.flushConsole(); }
private void abort() throws IOException { beep(); buf.clear(); println(); redrawLine(); }
public void abortCurrentRead() throws IOException { this.reader.println(); this.reader.println("Keyboard Interrupt"); this.reader.println(); this.inputSoFar.setLength(0); this.reader.setCursorPosition(0); this.reader.killLine(); this.reader.setPrompt(lastPrompt); this.reader.redrawLine(); this.reader.flush(); }
private boolean interruptTask() throws Exception { boolean interrupt = false; reader.getCursorBuffer().clear(); reader.redrawLine(); ConsoleTask task = getCurrentTask(); if (task != null) { synchronized (task) { log.debug("Interrupting task"); interrupt = true; if (task.isStopping()) { task.abort(); } else if (task.isRunning()) { task.stop(); } } } else { log.debug("No task running to interrupt"); } return interrupt; } }
redrawLine(); setBuffer(buffer);
reader.redrawLine(); reader.redrawLine();
/** * Possible states in which the current readline operation may be in. */ private static enum State { /** * The user is just typing away */ NORMAL, /** * In the middle of a emacs seach */ SEARCH, FORWARD_SEARCH, /** * VI "yank-to" operation ("y" during move mode) */ VI_YANK_TO, /** * VI "delete-to" operation ("d" during move mode) */ VI_DELETE_TO, /** * VI "change-to" operation ("c" during move mode) */ VI_CHANGE_TO }
/** * Clears the prompt of any text which has been inputted and redraws it. */ private void resetPrompt() { try { // Clear whatever text has currently been inputted boolean more = true; while (more) { more = reader.delete(); } more = true; while (more) { more = reader.backspace(); } // Clear parser state statementParser.reset(); // Redraw the prompt now because the error message has changed the terminal text reader.setPrompt(getPrompt().renderedString()); reader.redrawLine(); reader.flush(); } catch (IOException e) { logger.printError(e); } } }