Yes, I think your explanation of the concept is correct. Andre' gave a
few other examples, such as between italics and normal text. If you're
exactly on the boundary, should the next typed character be italic or
normal? And of course there's a similar situation between RTL and LTR...

What I don't understand is how the code of cursorRight and cursorLeft
relates to the concept. I don't see how the boundary gets set in the
first place: the conditions determining that we go into the code which sets the boundary seem to be unrelated --- or even opposite --- to what I would think they should be!

In cursorLeft and cursorRight the boundary is set by the last argument to setCursor. Normally, if the cursor is left of the last char, pos will be equal to row.endpos()-1. Then the next position is in the same line, but in front of the next character. Of course explicit newline are a bit different.

In cursorLeft, for example: what is the condition "cur.lastpos() != cur.pos()" for?
And "cur.textRow().pos() == cur.pos()" (what does it even mean?)?
And why the isNewLine and isLineSeparator?

I have fixed the logic now in my patch to equal that of LyX 1.4 exactly (see attached).

For the left case:

// if on right side of boundary (i.e. not at paragraph end, but line end)
// -> skip it, i.e. set boundary to true, i.e. go only logically left
// there are some exceptions to ignore this: lineseps, newlines, spaces
if (!cur.boundary() &&
    cur.textRow().pos() == cur.pos() &&
    cur.paragraph().isLineSeparator(cur.pos() - 1) &&
    !cur.paragraph().isNewline(cur.pos() - 1) &&
    !cur.paragraph().isSeparator(cur.pos() - 1)) {
    return setCursor(cur, cur.pit(), cur.pos(), true, true);
}

// normal character left
return setCursor(cur, cur.pit(), cur.pos() - 1, true, false);

So the general case is to move backward, with the exeception we are the row start (i.e. cur.textRow().pos() == cur.pos()) and not behind a newline, space, etc. The lastpos=pos condition was superflous. The cursorRight is more or less the opposite.

Attachment: cursordispatch.patch
Description: Binary data


Attachment: PGP.sig
Description: Signierter Teil der Nachricht

Reply via email to