-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI blocks until all results are collected #38
Comments
Hi @mizlan! This is something I have thought about from time to time. My personal use case for zf is usually within the scope of a single project, so I rarely have over 10,000 files to read into zf. This means I haven't given much thought to a incremental display. As you have observed, the current zf implementation is blocking. All of stdin is read into a buffer which is then split on lines. Those lines are then given to the UI code. The UI only runs the filtering on keypresses. So that's why you are seeing the current behavior. But I am planning on adding a UI preview feature sometime soon (once the next Zig version is released): #25. It seems like the next version will be the end of the month. That feature will require me to rework the event loop to be more async. As part of that, I think it would not be difficult to read from stdin in batches to make the UI immediately available. Another side to this is multithreading the filtering of zf. For large batches of input lines, the other issue would be making sure the filtering is very fast. Feel free to let me know your thoughts on that! |
Same! I was just curious I guess, it isn't a real problem for me almost ever in practice.
I think multithreading would be very very cool and interesting to see! Though I am interested in the Zig language, I am not super experienced in writing multithreaded programs, so I'm afraid I can't contribute too much, but I will be excitedly watching for updates to zf :) |
In that case I'll keep this issue open, but wait and see if there is someone with that use case. I am open to it right now, but I don't want to implement it if I don't need to.
I'll probably get to this in the next few weeks if everything goes according to plan :) |
Maybe it hadn't gone to plan yet? |
Would there be a way to incrementally display results? Currently if ran with
rg --files | zf
in home directory, there is a few seconds blocking until the prompt displays. I don't think it would be trivial to make it work but I am curious.The text was updated successfully, but these errors were encountered: