@Override public int getWidth() { return terminal.getWidth(); }
public int getWidth() { if (isPlainTerminal()) { return PLAIN_TERMINAL_WIDTH; } return terminal.getWidth(); }
public boolean isPlainTerminal() { // check if terminal width can be determined // e.g. IntelliJ IDEA terminal supports only a plain terminal return terminal.getWidth() == 0 && terminal.getHeight() == 0; }
@Override public int getWidth() { return terminal.getWidth(); }
@Override public int getWidth() { return terminal.getWidth(); }
@Override protected void doHandleResult(TerminalSizeAware result) { CharSequence toPrint = result.render(terminal.getWidth()); terminal.writer().println(toPrint); } }
ProgressThread( ProgressState progress, ProgressBarStyle style, long updateInterval, PrintStream consoleStream, String unitName, long unitSize, boolean isSpeedShown ) { this.progress = progress; this.style = style; this.updateInterval = updateInterval; this.consoleStream = consoleStream; this.killed = false; this.unitName = unitName; this.unitSize = unitSize; this.isSpeedShown = isSpeedShown; try { // Issue #42 // Defaulting to a dumb terminal when a supported terminal can not be correctly created // see https://github.com/jline/jline3/issues/291 this.terminal = TerminalBuilder.builder().dumb(true).build(); } catch (IOException ignored) { } if (terminal.getWidth() >= 10) // Workaround for issue #23 under IntelliJ consoleWidth = terminal.getWidth(); }
ProgressThread( ProgressState progress, ProgressBarStyle style, long updateInterval, PrintStream consoleStream, String unitName, long unitSize, boolean isSpeedShown ) { this.progress = progress; this.style = style; this.updateInterval = updateInterval; this.consoleStream = consoleStream; this.killed = false; this.unitName = unitName; this.unitSize = unitSize; this.isSpeedShown = isSpeedShown; try { // Issue #42 // Defaulting to a dumb terminal when a supported terminal can not be correctly created // see https://github.com/jline/jline3/issues/291 this.terminal = TerminalBuilder.builder().dumb(true).build(); } catch (IOException ignored) { } if (terminal.getWidth() >= 10) // Workaround for issue #23 under IntelliJ consoleWidth = terminal.getWidth(); }
this.atime = now; this.max = Math.max(Strings.length(file), max); int len = Math.max(terminal.getWidth(), 120);
private void toColumn(CommandSession session, Process process, PrintStream out, Stream<String> ansi, boolean horizontal) { Terminal terminal = Shell.getTerminal(session); int width = process.isTty(1) ? terminal.getWidth() : 80; List<AttributedString> strings = ansi.map(AttributedString::fromAnsi).collect(Collectors.toList()); if (!strings.isEmpty()) {
/** * Create a new renderer * @param vertx the current Vert.x instance * @return the renderer */ public static ImportProgressRenderer create(Vertx vertx) { // get capabilities of the terminal int terminalWidth; boolean dumb; try (Terminal terminal = TerminalBuilder.terminal()) { terminalWidth = terminal.getWidth(); dumb = Terminal.TYPE_DUMB.equalsIgnoreCase(terminal.getType()) || Terminal.TYPE_DUMB_COLOR.equalsIgnoreCase(terminal.getType()); } catch (IOException e) { terminalWidth = DEFAULT_TERMINAL_WIDTH; dumb = true; } if (terminalWidth < MIN_TERMINAL_WIDTH) { terminalWidth = DEFAULT_TERMINAL_WIDTH; } // determine refresh interval long interval; if (dumb) { interval = DEFAULT_INTERVAL_SLOW; } else { interval = DEFAULT_INTERVAL; } // create renderer return new ImportProgressRenderer(interval, terminalWidth, vertx); }
final int terminalWidth = terminal.getWidth(); final int ID_WIDTH = 3; final int STATUS_WIDTH = 20;
final char LINE_SEP = '-'; int terminalWidth = terminal.getWidth();
modes.put(PtyMode.ONLRET, getFlag(attributes, Attributes.OutputFlag.ONLRET)); channel.setPtyModes(modes); channel.setPtyColumns(terminal.getWidth()); channel.setPtyLines(terminal.getHeight()); channel.setAgentForwarding(true);
session.put(Shell.VAR_SESSION, session); session.put("#TERM", (Function) (s, arguments) -> terminal.getType()); session.put("#COLUMNS", (Function) (s, arguments) -> terminal.getWidth()); session.put("#LINES", (Function) (s, arguments) -> terminal.getHeight()); session.put("#PWD", (Function) (s, arguments) -> s.currentDir().toString());
if (previous == Status.Background || current == Status.Background || previous == Status.Suspended || current == Status.Suspended) { int width = terminal.getWidth(); String status = current.name().toLowerCase(); terminal.writer().write(getStatusLine(job, width, status));
final int width = (maxWidth == 0 && sqlLine.getLineReader() != null ? sqlLine.getLineReader().getTerminal().getWidth() : maxWidth) - 4;
final int width = (maxWidth == 0 && sqlLine.getLineReader() != null ? sqlLine.getLineReader().getTerminal().getWidth() : maxWidth) - 4;
terminalBuilder = terminalBuilder.system(true); terminal = terminalBuilder.build(); getOpts().set(BuiltInProperty.MAX_WIDTH, terminal.getWidth()); getOpts().set(BuiltInProperty.MAX_HEIGHT, terminal.getHeight());
terminalBuilder = terminalBuilder.system(true); terminal = terminalBuilder.build(); getOpts().set(BuiltInProperty.MAX_WIDTH, terminal.getWidth()); getOpts().set(BuiltInProperty.MAX_HEIGHT, terminal.getHeight());