On Wednesday 24 July 2002 09:42 pm, you wrote: > > It does seem excessive. > > The same happens if I click to select a cell, and then move the mouse > (holding the button) *within* the cell. There seems to be constant > redrawing even though there is no reason for this! I think there should be > only a redraw when the pointer leaves the cell (and then only the newly > entered cell needs to be redrawn once), or when the pointer hits the border > of the visible area.
The thing below is seems to be already better I think it saves some calls to updateLocal(bv, SELECTION, false). Yet setPos(bv, x, y) still seems excessively expensive when we are only moving the mouse in an already selected cell...maybe we should store left bottom (x0,y0) and right top (x1,y0) of the active cell. (This could be very cheaply updated when going to another cell with the keyboard (dunno with the mouse though) this way we could avoid all the looping in setPos (and also getCellXPos) which seems again a bit excessive.) With the (x0,y0),(x1,y1) we could quickly check whether we leave the selected cell and only then call setPos. Ed. void InsetTabular::insetMotionNotify(BufferView * bv, int x, int y, mouse_button::state button) { if (the_locking_inset) { the_locking_inset->insetMotionNotify(bv, x - inset_x, y - inset_y, button); return; } hideInsetCursor(bv); + int const old_cell = actcell; setPos(bv, x, y); if (!hasSelection()) { setSelection(actcell, actcell); + updateLocal(bv, SELECTION, false); - } else { + } else if (old_cell!=actcell) { setSelection(sel_cell_start, actcell); + updateLocal(bv, SELECTION, false); } - updateLocal(bv, SELECTION, false); showInsetCursor(bv); } > > Ed.