GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Less initial render can open mostly blank on Windows · Issue #1883 · jline/jline3 Closed DescriptionWhen using the Less class, the content is loaded and can be revealed by scrolling (up or down), but The issue appears to be in the interaction between Less, I have a minimal reproduction example, the code writes a block of text to the Jline3 version: 3.30.13 package repro; import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import java.util.Locale; import org.jline.builtins.Less; import org.jline.builtins.Source; import org.jline.reader.LineReader; import org.jline.reader.LineReaderBuilder; import org.jline.terminal.Terminal; import org.jline.terminal.TerminalBuilder; public final class JLineLessWindowsRepro { private static final String PROMPT = "> "; private final Terminal terminal; private final LineReader reader; private JLineLessWindowsRepro(Terminal terminal) { this.terminal = terminal; this.reader = LineReaderBuilder.builder() .terminal(terminal) .appName("jline-less-windows-repro") .build(); } public static void main(String[] args) throws Exception { try (Terminal terminal = TerminalBuilder.builder() .name("jline-less-windows-repro") .system(true) .dumb(false) .build()) { new JLineLessWindowsRepro(terminal).run(); } } private void run() throws Exception { printBanner(); while (true) { if (!handle(reader.readLine(PROMPT))) { break; } } } private boolean handle(String rawLine) throws Exception { String command = rawLine == null ? "" : rawLine.trim().toLowerCase(Locale.ROOT); if (command.isEmpty()) { return true; } if ("exit".equals(command)) { return false; } if ("repro".equals(command)) { repro(); } else { terminal.writer().println("Type 'repro' to reproduce, or 'exit' to exit."); terminal.flush(); } return true; } private void printBanner() { terminal.writer().println("JLine Less Windows VTP repro"); terminal.writer().println("Java: " + System.getProperty("java.version") + ", OS: " + System.getProperty("os.name")); terminal.writer().println("Terminal: " + terminal.getName() + " / " + terminal.getType() + " / " + terminal.getSize()); terminal.writer().println("Type 'repro'. Type 'exit' to exit."); terminal.flush(); } private void repro() throws Exception { String text = wallOfText(); terminal.writer().print(text); terminal.flush(); Less less = new Less(terminal, Path.of(".")); ByteArrayInputStream input = new ByteArrayInputStream( text.getBytes(StandardCharsets.UTF_8)); List<Source> sources = new ArrayList<>(); sources.add(new Source.InputStreamSource(input, true, "repro.txt")); less.run(sources); } private String wallOfText() { StringBuilder builder = new StringBuilder(); builder.append("Generated text for JLine Less\n"); builder.append("The first visible line should be at the top of the pager.\n"); builder.append("On affected Windows terminals, the first Less render starts\n"); builder.append("near the row where the cursor was before Less opened.\n\n"); for (int i = 1; i <= 180; i++) { builder.append(String.format( Locale.ROOT, "%03d repro row for viewport-origin rendering.%n", i)); } return builder.toString(); } } Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |