简体   繁体   English

Jline终端编写器输出格式错误的输出

[英]Jline Terminal Writer Outputting Wrong Formatted Output

We're having some issues with the Jline library terminal when trying to use it's writer. 尝试使用Jline库终端的writer时,我们遇到了一些问题。 When we try to write a string using the terminal writer's print statement, it's appending characters around the string. 当我们尝试使用终端编写器的print语句编写字符串时,它会在字符串周围附加字符。

Example: When printing: terminal.writer().print("Username:"); 示例:打印时: 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. 我们获得的输出字符串为“ ... [?1l >> [?1000l。[?2004lUsername:] [?1h。== [[2004h]”,此处我们只想获取“ Username:”作为输出。

We've tried the solution from this link https://github.com/jline/jline3/issues/181 by setting the "BRACKETED_PASTE_OFF". 我们已通过设置“ BRACKETED_PASTE_OFF”从此链接https://github.com/jline/jline3/issues/181尝试了该解决方案。 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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM