本文整理了Java中org.jline.terminal.Terminal.getWidth()
方法的一些代码示例,展示了Terminal.getWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Terminal.getWidth()
方法的具体详情如下:
包路径:org.jline.terminal.Terminal
类名称:Terminal
方法名:getWidth
暂无
代码示例来源:origin: confluentinc/ksql
@Override
public int getWidth() {
return terminal.getWidth();
}
代码示例来源:origin: apache/flink
public int getWidth() {
if (isPlainTerminal()) {
return PLAIN_TERMINAL_WIDTH;
}
return terminal.getWidth();
}
代码示例来源:origin: apache/flink
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;
}
代码示例来源:origin: org.apache.karaf.shell/org.apache.karaf.shell.core
@Override
public int getWidth() {
return terminal.getWidth();
}
代码示例来源:origin: apache/karaf
@Override
public int getWidth() {
return terminal.getWidth();
}
代码示例来源:origin: org.springframework.shell/spring-shell-core
@Override
protected void doHandleResult(TerminalSizeAware result) {
CharSequence toPrint = result.render(terminal.getWidth());
terminal.writer().println(toPrint);
}
}
代码示例来源:origin: ctongfei/progressbar
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();
}
代码示例来源:origin: me.tongfei/progressbar
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();
}
代码示例来源:origin: leonchen83/redis-rdb-cli
this.atime = now;
this.max = Math.max(Strings.length(file), max);
int len = Math.max(terminal.getWidth(), 120);
代码示例来源:origin: apache/felix
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()) {
代码示例来源:origin: georocket/georocket
/**
* 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);
}
代码示例来源:origin: apache/samza
final int terminalWidth = terminal.getWidth();
final int ID_WIDTH = 3;
final int STATUS_WIDTH = 20;
代码示例来源:origin: apache/samza
final char LINE_SEP = '-';
int terminalWidth = terminal.getWidth();
代码示例来源:origin: org.jline/jline
modes.put(PtyMode.ONLRET, getFlag(attributes, Attributes.OutputFlag.ONLRET));
channel.setPtyModes(modes);
channel.setPtyColumns(terminal.getWidth());
channel.setPtyLines(terminal.getHeight());
channel.setAgentForwarding(true);
代码示例来源:origin: apache/felix
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());
代码示例来源:origin: apache/felix
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));
代码示例来源:origin: sqlline/sqlline
final int width = (maxWidth == 0
&& sqlLine.getLineReader() != null
? sqlLine.getLineReader().getTerminal().getWidth()
: maxWidth) - 4;
代码示例来源:origin: julianhyde/sqlline
final int width = (maxWidth == 0
&& sqlLine.getLineReader() != null
? sqlLine.getLineReader().getTerminal().getWidth()
: maxWidth) - 4;
代码示例来源:origin: sqlline/sqlline
terminalBuilder = terminalBuilder.system(true);
terminal = terminalBuilder.build();
getOpts().set(BuiltInProperty.MAX_WIDTH, terminal.getWidth());
getOpts().set(BuiltInProperty.MAX_HEIGHT, terminal.getHeight());
代码示例来源:origin: julianhyde/sqlline
terminalBuilder = terminalBuilder.system(true);
terminal = terminalBuilder.build();
getOpts().set(BuiltInProperty.MAX_WIDTH, terminal.getWidth());
getOpts().set(BuiltInProperty.MAX_HEIGHT, terminal.getHeight());
内容来源于网络,如有侵权,请联系作者删除!