Full refresh when highlighting text is quite annoying, I fixed it by
using 'ui' refresh type.
And this patch also fixed a bug that after cleaning temporary highlights
the screen is not refreshed.
This is a larger clean-up of the refresh situation.
The general shift is that refreshes are now mainly triggered by
the (top-level) widgets when they get shown or closed via UIManager.
All refreshes for the widgets when they are in use were handled by
themselves before. This adds the case of showing/closing.
It is the desired result of not having UIManager:show()/:close()
do (full screen) refreshes on its own.
This eliminates the API difference between the extra parameters of
UIManager:show() and setDirty(). They work the same now.
Note that this also eliminates the automatic refresh that took place
before when using show() without refresh options. It always refreshed
the full screen, which led to too big refresh regions all over the
place. Thus, refresh has now explicitly to be asked for, hopefully
encouraging to implement it in the widget that gets shown (and is
aware about the screen region it covers).
Also add an event that is triggered when a widget is closed:
CloseWidget. So a widget can implement "onCloseWidget()" to trigger
actions upon closing - most commonly, this is a refresh for the area
previously taken by the widget. That way, the widget's user does not
have to take measures to ensure that the area is refreshed later.
for now, we have show() automatically call setDirty() for the new
widget, as before. However, now show() takes two arguments for
refresh configuration that will get passed on to setDirty().
For compatibility, the default is here in show() to do a partial
refresh. So if you want no refresh triggered (via this show() call),
add a function that doesn't return anything.
it was set to a full refresh. However, we want to behave as if in
non-scrolling mode and issue a partial refresh. That might get
updated to a full refresh if the full-refresh counter has reached
the limit - which is configurable.