We're having some issues with the Jline library terminal when trying to use it's writer. When we try to write a string using the terminal writer's print statement, it's appending characters around the string.
Example: When printing: terminal.writer().print("Username:");
We get the output string as " [?1l > [?1000l [?2004lUsername: [?1h = [?2004h", where as we want to get only "Username:" as the output.
We've tried the solution from this link https://github.com/jline/jline3/issues/181 by setting the "BRACKETED_PASTE_OFF". But that didn't work.
我可以正常工作了,我必须使用printAbove来删除读取一行时添加的字符串,并将BRACKETED_PASTE设置为false以删除在清理阶段添加的括号:
final TerminalBuilder builder = TerminalBuilder.builder(); builder.jansi(false); builder.streams(in, out); terminal = builder.build(); reader = LineReaderBuilder.builder().terminal(terminal).build(); reader.option(BRACKETED_PASTE, false); reader.printAbove(StringToPrint); terminal.writer().print(StringToPrint);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.