jline / jline3

JLine is a Java library for handling console input.
Other
1.49k stars 218 forks source link

If the message after the prompt is longer than the printed text the text is ahown after the message #512

Closed derklaro closed 4 years ago

derklaro commented 4 years ago
[24.02.2020 09:06:25 INFO] Authentication of Proxy#1 (Node-1f3b31c1) was successfulegzfgezfgezgfzegfzegfz
[rc-2.0.4-SNAPSHOT@Pasqual ~]$ testgzdgzgefgfgefgefgzegfzgezfgzegfzegfzegfzegfzegzfegzfgezfgezgfzegfzegfz

Code to print a line:

        lineReader.getTerminal().puts(InfoCmp.Capability.carriage_return);
        lineReader.getTerminal().writer().print(message);
        lineReader.getTerminal().writer().flush();

        if (!lineReader.isReading()) {
            return;
        }

        lineReader.callWidget(LineReader.REDRAW_LINE);
        lineReader.callWidget(LineReader.REDISPLAY);

Can you please help me? This looks very stupid xD

gnodet commented 4 years ago

Try clearing the line ...

        lineReader.getTerminal().puts(InfoCmp.Capability.carriage_return);
        lineReader.getTerminal().puts(InfoCmp.Capability.clr_eol);
        lineReader.getTerminal().writer().print(message);
        lineReader.getTerminal().writer().flush();
derklaro commented 4 years ago

This works fine! Thank you.