It might happen that the selection goes away without recomputing
metrics (for example with char-forward). The added test is a bit of a
band-aid for this situation. A better solution would be to understand
better when metrics computation is triggered in mathed.
#include "BufferView.h"
#include "ColorSet.h"
#include "CoordCache.h"
+#include "Cursor.h"
#include "LyXRC.h"
#include "MetricsInfo.h"
x += e.before + e.after;
break;
case BEGIN_SEL:
- change_color = pi.base.font.changeColor(Color_selectionmath);
+ // Change the color if the selection is indeed active
+ // FIXME: it would be better to make sure that metrics are
+ // computed again when selection status changes.
+ if (pi.base.bv->cursor().selection())
+ change_color = pi.base.font.changeColor(Color_selectionmath);
break;
case END_SEL:
change_color = noChange();