Georg Baum wrote:
Am Donnerstag, 4. Januar 2007 18:52 schrieb Abdelrazak Younes:
Bo Peng wrote:
I see that when I selection in nedit, lyx outputs 'lost selection'. So
there is a missing update. Abdel?
This is not about painting at all. "Lost X selection" just means that
LyX lost the token. The formally selected text should stay selected.
This is where people disagree. Some people want the selection to stay
selected (approach A), some people want that it is cleared (approach B).
I clearly prefer approach B.
Thus, there is nothing to redraw.
That is not true: The implementation in LyX clearly follows approach B and
wants to clear the selection. Otherwise it would not call
cursor_.clearSelection() in BufferView::clearSelection().
The attached patch actually triggers the redraw. Can you please tell me
whether I did it right?
Almost ;-)
+ update(Update::Force);
Just use "updateMetrics(false)" because "update(Update::Force)" will
also update the macro store and this is not needed here. Actually even
that is not needed, see below.
+ buffer_->changed();
In principle this should not be needed as the buffer did not change. But
if you want a screen update, we need that indeed. This is telling me
that we don't call the appropriate function: For a background change we
don't need to update the metrics at all. So, in theory, all that is
needed for a screen update is:
+ buffer_->changed();
Of course this is about X11 so I cannot verify that this is correct.
Note that buffer_->changed() will trigger a full updateMetrics() on all
other views that share the same buffer.
If we want to implement approach A we should not not call
cursor_.clearSelection() in BufferView::clearSelection(). The current code
is neither correct for approach A nor for B.
Indeed and I would prefer that a lot.
Abdel.