chiark / gitweb /
Implement a visible 'busy' indicator.
authorSimon Tatham <anakin@pobox.com>
Sun, 4 Feb 2024 14:23:48 +0000 (14:23 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 4 Feb 2024 15:02:40 +0000 (15:02 +0000)
commit72e5bbe02ee415d8f514e010e5f1e8dfeec813fb
tree8aadc380baf3ee8e2b4a580018ce1b05cd829433
parentcc9258b50974108d03bbe03e1c5ca2b2e4d5766c
Implement a visible 'busy' indicator.

This is implemented by giving Client a reference to the TuiOutput,
which it can call to notify that a network operation has started. So
whenever any keystroke results in network activity, we immediately
update the screen to indicate that something is happening that takes
time, reducing the risk that the user will believe their keystroke was
ignored.

The Client's reference is wrapped in a new 'TuiBusyIndicator' struct,
in case we need to change the notification mechanism. (For example, if
this business ever starts to sprawl across multiple threads, it might
be more convenient to make TuiBusyIndicator contain the sending end of
a sync_channel, so that the display thread would receive the busy
indication from wherever it was sent.)

All client activity goes via the just-moved execute_and_log_request
method, so that's the only place I need to insert a call to set_busy.
So this causes no extra boilerplate per Client method.
TODO.md
src/client.rs
src/tui.rs