【问题标题】:JLine autocomplete not showing and running onComplete after pressing enter按下回车后,JLine 自动完成不显示并运行 onComplete
【发布时间】:2019-09-01 13:08:45
【问题描述】:

由于某种原因,我的多线程 netty 服务器无法在 Windows 上使用自动完成功能(在我最初的测试中,linux 运行良好) 我发现终端控制台 appender 和 jansi 是解决很多问题的“解决方案”,除了这个。奇怪的是我的客户端运行相同的代码函数来调用 lineReader.readLine("> ");使用几乎完全相同的代码自动完成工作非常好。我不知道是什么问题,因为它们都以相同的顺序调用相同的代码,具有相同的依赖项(一些服务器端依赖项除外)

来源:https://github.com/Fernthedev/light-chat

服务器读取代码:https://github.com/Fernthedev/light-chat/blob/master/java/server/src/main/java/com/github/fernthedev/server/ServerCommandHandler.java

客户端读取代码:https://github.com/Fernthedev/light-chat/blob/master/java/client/src/main/java/com/github/fernthedev/client/WaitForCommand.java

StaticHandler(用于读取和设置终端和阅读器):https://github.com/Fernthedev/light-chat/blob/master/java/universalChat/src/main/java/com/github/fernthedev/universal/StaticHandler.java

服务器和客户端都有一个带有 main(String[] args) 方法的主类

【问题讨论】:

  • 您遇到了什么错误?
  • 没有错误,就是问题所在。它只是插入一个制表符空间,如果我按回车,它不会显示自动完成但 readLine();确实像我选择它一样处理自动完成。

标签: java log4j jline


【解决方案1】:

我缩小了强制 TerminalConsoleAppender 制作哑终端的问题,所以我禁用了它,然后完全着色 jline 和 jline-terminal-jansi 并完美运行。

【讨论】:

    猜你喜欢
    • 2016-08-26
    • 2013-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-24
    相关资源
    最近更新 更多