>>>>> "Alfredo" == Alfredo Braunstein <[EMAIL PROTECTED]> writes:

Alfredo> Hi JMarc,
Alfredo> Jean-Marc Lasgouttes wrote:

>> See: http://bugzilla.lyx.org/show_bug.cgi?id=1609
>> 
>> This patch fixes LyXText::getWord to operate on full LCursor
>> instances instead of simple CursorSlices. This fixes word
>> selection, which was the problem in bug 1609.

Alfredo> I don't get exactly why this solves 1609, could you enlighten
Alfredo> me? 1609 doesn't seem about needing 'deeper' cursors (at
Alfredo> least at my dumb eyes). I feel rusty ;-)

1609 is about selecting words properly. To this end one wants to
obtain a 'from' and a 'to' cursor. To this end, one starts from the
current cursor, then goes to the left to find the start of word (from)
and then to the right to find the end of word (to).

The whole point of the patch is the change below: 
-               cursorLeftOneWord(bv()->cursor());
+               cursorLeftOneWord(from);

Going left from bv->cursor() does not make sense at all, but
unfortunaltey we need to have a LCursor to pass, and originally 'from'
is just a slice. Therefore I decided to change the code to use LCursor
all over. Note that all the users of getWord do have a LCursor to
operate on, but they only passed a slice of that.

Alfredo> I'd use DocIterator instead of LCursor if you just need it
Alfredo> only for positioning (and do not need the selection/dispatch
Alfredo> part).

But, cursorLeftOneWord requires a word, doesn't it? 

An alternative way of doing it would be not to use cursorLeftOneWord
at all, but do the move to the left 'by hand'. Would you prefer that?

JMarc

Reply via email to