chiark / gitweb /
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.