gpt4 book ai didi

user-interface - 将提示锁定在屏幕底部

转载 作者:IT王子 更新时间:2023-10-29 00:44:25 25 4
gpt4 key购买 nike

全部。我正在用 Go 编写一个聊天客户端,作为我正在编写的库的概念验证。它需要在同一个终端窗口中接受用户输入并打印传入的消息。请考虑以下事项。

user@debian ~ $ ./client
no session> 192.168.1.100
> Hello, there!
Hi!
> So, did you get that feature working yet?
Nope. I thought you were going to ask on StackOverflow.
>> Yeah, I'm aski

如果在我打字时收到另一条消息,那么它应该产生以下结果。

user@debian ~ $ ./client
no session> 192.168.1.100
> Hello, there!
Hi!
> So, did you get that feature working yet?
Nope. I thought you were going to ask on StackOverflow.
Or did you want me to?
>> Yeah, I'm aski

有没有办法在 Go 中做到这一点?

谢谢:)

最佳答案

如果您曾经使用过具有类似行为的控制台应用程序,它可能使用了像 ncurses 这样的库来执行此操作。您不会想自己编写程序,因为它非常复杂。

对于 Go,我推荐 termbox-go .它很容易拿起并且结构合理 api .

关于user-interface - 将提示锁定在屏幕底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13483585/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com