ITADN

clear input buffer

#246Closedeasymind76 创建于 2025-04-14
E
easymind76commented
I am using github.com/gliderlabs/ssh with readline. I am not 100% sure if the issue is with ssh. But I am using the normal loop with inside the loop: line, err := rl.Readline() Now there is a situation when a certain line is given where I want to stop any input and output for a while. So I wait for a channel, preventing going to line, err := rl.Readline() again in the loop. When the channel recieves a value, we continue the loop and we get back to line, err := rl.Readline() on top of the loop. The issue is that if any keys were pressed while waiting for the channel, the rl.Readline() will output all these keys. I need a way to clear the 'buffer'. So that when I do rl.Readline() we just wait for new input untill enter is pressed.
关闭于 2025-04-14 1 条评论