-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: responsive and buttery-smooth UI while scanning in interactive…
…mode. (#209) Using `dua i` the GUI would populate and is fully usable even while the scan is in progress, which is fantastic when scanning big disks which can take several minutes. However, previously is was quite janky as the refresh loop was bound to receiving entries to process, which sometimes stalled for many seconds. Now the GUI refresh is uncoupled from receiving traversal entries, and it will update when the user presses a key or 250ms pass without any input, causing it to respond immediately. Thanks so much for contributing, [@unixzii](https://github /unixzii)!
- Loading branch information
Showing
6 changed files
with
227 additions
and
137 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
usecrossbeam::channel::Receiver; | ||
pubusecrosstermion::crossterm::event::Event; | ||
|
||
enumAction<T>{ | ||
Continue, | ||
Result(Result<T,std::io::Error>), | ||
} | ||
|
||
fncontinue_on_interrupt<T>(result:Result<T,std::io::Error>)->Action<T>{ | ||
matchresult{ | ||
Ok(v)=>Action::Result(Ok(v)), | ||
Err(err)iferr.kind()== std::io::ErrorKind::Interrupted=>Action::Continue, | ||
Err(err)=>Action::Result(Err(err)), | ||
} | ||
} | ||
|
||
pubfninput_channel()->Receiver<Event>{ | ||
let(key_send,key_receive)= crossbeam::channel::bounded(0); | ||
std::thread::spawn(move|| ->Result<(),std::io::Error>{ | ||
loop{ | ||
letevent =matchcontinue_on_interrupt(crosstermion::crossterm::event::read()){ | ||
Action::Continue=>continue, | ||
Action::Result(res)=> res?, | ||
}; | ||
ifkey_send.send(event).is_err(){ | ||
break; | ||
} | ||
} | ||
Ok(()) | ||
}); | ||
key_receive | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ mod bytevis; | |
modcommon; | ||
modeventloop; | ||
modhandlers; | ||
modinput; | ||
modnavigation; | ||
pubmodtree_view; | ||
|
||
|
Oops, something went wrong.