Edwin Leuven wrote:
> John Levon wrote:
>> On Thu, Oct 26, 2006 at 01:06:14PM +0200, Peter Kümmel wrote:
>>
>>> Was this the bug Asger talked about ('Fix cursor trouble')?
>>
>> Possibly that selecting within an inset is broken?
>
> and:
>
> 1. when typing in math the cursor blinks before the math inset
> before returning to the right position
>
> 2. cursor and selection are not synchronized:
>
> - when selecting with the keyboard the cursor moves
> before the selection
>
> - when selecting with the mouse the cursor lags behind
> the selection (and therefore also outside the selection
> when making the selection smaller)
>
>
Here a hint: at the toggle line the cursor position is not
up-to-date when a key press is handled.
void WorkArea::processKeySym(LyXKeySymPtr key, key_modifier::state state)
{
hideCursor();
theLyXFunc().setLyXView(&lyx_view_);
theLyXFunc().processKeySym(key, state);
/* This is perhaps a bit of a hack. When we move
* around, or type, it's nice to be able to see
* the cursor immediately after the keypress. So
* we reset the toggle timeout and force the visibility
* of the cursor. Note we cannot do this inside
* dispatch() itself, because that's called recursively.
*/
// if (buffer_view_->buffer())
toggleCursor();
}
cursorPos returns in the if (!coord_cache.getArrays().has(&ar))
the coord_cache doesn't have &ar.
void InsetMathNest::cursorPos(BufferView const & bv,
CursorSlice const & sl, bool /*boundary*/,
int & x, int & y) const
{
// FIXME: This is a hack. Ideally, the coord cache should not store
// absolute positions, but relative ones. This would mean to call
// setXY() not in MathArray::draw(), but in the parent insets' draw()
// with the correctly adjusted x,y values. But this means that we'd have
// to touch all (math)inset's draw() methods. Right now, we'll store
// absolute value, and make them here relative, only to make them
// absolute again when actually drawing the cursor. What a mess.
BOOST_ASSERT(ptr_cmp(&sl.inset(), this));
MathArray const & ar = sl.cell();
CoordCache const & coord_cache = bv.coordCache();
if (!coord_cache.getArrays().has(&ar)) {
// this can (semi-)legally happen if we just created this cell
// and it never has been drawn before. So don't ASSERT.
//lyxerr << "no cached data for array " << &ar << endl;
x = 0;
y = 0;
return;
}
Hope this helps a bit.
Peter