public winsize(Size ws) { ws_row = (short) ws.getRows(); ws_col = (short) ws.getColumns(); }
public Size toSize() { return new Size(ws_col, ws_row); }
public WebTerminal(int width, int height, InputStream input, OutputStream output) throws IOException { super("Karaf Web Terminal", "ansi", input, output, StandardCharsets.UTF_8); size.setColumns(width); size.setRows(height); }
public void copy(Size size) { setColumns(size.getColumns()); setRows(size.getRows()); }
protected void handleSignal(Signal signal) { if (signal == Signal.WINCH) { size.copy(terminal.getSize()); display.resize(size.getRows(), size.getColumns()); redisplay(); } else if (signal == Signal.CONT) { terminal.enterRawMode(); size.copy(terminal.getSize()); display.resize(size.getRows(), size.getColumns()); terminal.puts(Capability.keypad_xmit); redrawLine(); redisplay(); } }
protected synchronized void redraw() { long[] screen = new long[size.getRows() * size.getColumns()]; } else { terminal.dump(screen, terminal.top(), terminal.left(), size.getRows(), size.getColumns(), terminal == active ? cursor : null); Arrays.fill(screen, (size.getRows() - 1) * size.getColumns(), size.getRows() * size.getColumns(), 0x20000080L << 32 | 0x0020L); boolean prevHasFg = false; boolean prevHasBg = false; for (int y = 0; y < size.getRows(); y++) { AttributedStringBuilder sb = new AttributedStringBuilder(size.getColumns()); for (int x = 0; x < size.getColumns(); x++) { long d = screen[y * size.getColumns() + x]; int c = (int) (d & 0xffffffffL); int a = (int) (d >> 32); display.resize(size.getRows(), size.getColumns()); display.update(lines, size.cursorPos(cursor[1], cursor[0]));
@Override public int getWidth() { return size.getColumns(); }
if (jlineTerminal.getSize().getColumns() == 0) { jlineTerminal.setSize(new Size(80, 24));
@Override public int getHeight() { return size.getRows(); }
private void handle(Terminal.Signal signal) { int prevw = size.getColumns(); size.copy(terminal.getSize()); try { if (size.getColumns() < prevw) { display.clear(); } display(); } catch (IOException e) { // ignore } }
public Size getSize() { long outputHandle = Kernel32.GetStdHandle(Kernel32.STD_OUTPUT_HANDLE); CONSOLE_SCREEN_BUFFER_INFO info = new CONSOLE_SCREEN_BUFFER_INFO(); Kernel32.GetConsoleScreenBufferInfo(outputHandle, info); Size size = new Size(); size.setColumns(info.size.x); size.setRows(info.size.y); return size; }
synchronized void display() { if (nbBindings > 0) { if (--nbBindings == 0) { message = null; } } List<AttributedString> header = buffer.computeHeader(); List<AttributedString> footer = computeFooter(); int nbLines = size.getRows() - header.size() - footer.size(); List<AttributedString> newLines = buffer.getDisplayedLines(nbLines); newLines.addAll(0, header); newLines.addAll(footer); // Compute cursor position int cursor; if (editMessage != null) { cursor = editMessage.length() + editBuffer.length(); cursor = size.cursorPos(size.getRows() - footer.size(), cursor); } else { cursor = size.cursorPos(header.size(), buffer.getDisplayedCursor()); } display.update(newLines, cursor); }
public void setSize(Size sz) { size.copy(sz); }
private void handleResize() { // Re-compute the layout if (resized.compareAndSet(true, false)) { size.copy(terminal.getSize()); } layout.resize(size.getColumns(), size.getRows() - 1); panes.forEach(vc -> { if (vc.width() != vc.layout.sx || vc.height() != vc.layout.sy || vc.left() != vc.layout.xoff || vc.top() != vc.layout.yoff) { vc.resize(vc.layout.xoff, vc.layout.yoff, vc.layout.sx, vc.layout.sy); display.clear(); } }); }
protected synchronized void redraw() { long[] screen = new long[size.getRows() * size.getColumns()]; } else { terminal.dump(screen, terminal.top(), terminal.left(), size.getRows(), size.getColumns(), terminal == active ? cursor : null); Arrays.fill(screen, (size.getRows() - 1) * size.getColumns(), size.getRows() * size.getColumns(), 0x20000080L << 32 | 0x0020L); boolean prevHasFg = false; boolean prevHasBg = false; for (int y = 0; y < size.getRows(); y++) { AttributedStringBuilder sb = new AttributedStringBuilder(size.getColumns()); for (int x = 0; x < size.getColumns(); x++) { long d = screen[y * size.getColumns() + x]; int c = (int) (d & 0xffffffffL); int a = (int) (d >> 32); display.resize(size.getRows(), size.getColumns()); display.update(lines, size.cursorPos(cursor[1], cursor[0]));
void resetDisplay() { int width = size.getColumns() - (printLineNumbers ? 8 : 0); column = offsetInLine + column; offsetInLine = (column / width) * (width - 1); column = column - offsetInLine; }
if (jlineTerminal.getSize().getColumns() == 0) { jlineTerminal.setSize(new Size(80, 24));
@Override public int getHeight() { return size.getRows(); }
private void handle(Terminal.Signal signal) { int prevw = size.getColumns(); size.copy(terminal.getSize()); try { if (size.getColumns() < prevw) { display.clear(); } display(); } catch (IOException e) { // ignore } }