> mutable bool margin_beg_sel; > mutable bool margin_end_sel; if these bools indicate whether you want to draw some selection to either the left or right, why not simply call them:
leftmargin_sel rightmargin_sel (just ignore me if it shows that i didn't study your patch)
