On Thu, Jan 14, 2016 at 03:59:41PM +0000, Guillaume Munch wrote: > Le 13/01/2016 22:03, Enrico Forestieri a écrit : > >On Tue, Jan 12, 2016 at 11:48:41PM +0000, Guillaume Munch wrote: > > > >>Now I noticed that the "after" position can still be accessed with mouse > >>clicks at the end of the line. I imagine that there can still be many > >>commands that can produce this "after" position. > > > >I remember that I was only able to void that position when clicking > >with the mouse sufficiently far away from the end of the line. If the > >click was precisely just after the last character, the damn'd cursor > >was positioned there. I am afraid I don't know the part of the code > >that deals with this and will not be able to correct it. I thought > >that, given that the mouse has to be in a very restricted area of the > >screen for that to happen, it was not much of an annoyance. > > We might be speaking of two different issues: > > * If I click on the right-hand half of the separator, the cursor moves > after the separator both visually and logically (a position that cannot > be reached using ← and →). > > * If I click further on the line to the right of the separator (does not > need to be too far away), then the cursor gets located visually to the > left and logically to the right (what could be reached using ↑ and ↓ > until your patch). > > To see if the cursor is logically to the left or the right of the > separator, I try to see which of Del of Backspace deletes it.
I have now found where to tweak the sources and the attached x1.diff patch solves the issue for me. > >>A second issue I just noticed is when deleting the separator: the > >>paragraph after should not immediately be merged with the one that > >>contains the deleted separator, if none is empty, I think. Hitting Del > >>should just remove the separator. (To test this, start with two > >>non-empty enumerate environments with a par break separator at the end > >>of the first one, and then try to delete the separator.) > > > >I will have a look at this. The attached x2.diff patch takes care of this. It seems that this behavior was a deliberate choice of mine, but it was wrong, apparently. > >>>If you think that hitting enter should introduce a plain separator > >>>instead of a parbreak one, this would be accomplished in the sources > >>>with a really trivial change. I choose a parbreak simply because it > >>>is completely equivalent to the old Separator layout. > >>>However, note that when importing old documents, the old Separator > >>>layout has still to be converted to a parbreak separator, otherwise > >>>the output might be changed. > >>> > >> > >>I did not think of it this way but, yes, this would be a convenient > >>solution. The main advantage, I find, is the overall consistency in > >>the chosen solution, in particular with Alt+M P. > > > >This would be accomplished by the attached patch. > > > > Indeed the patch is trivial and I can vouch for it (if needed > symbolically). Please commit it if you are convinced as well that this > is a good solution. I took this as a +1 and committed the patch. > Thanks for looking into these issues. You're welcome. > Also, thanks for fixing the original issue. I saw the benefits no later > than yesterday with beamer. LyX used to cause all sorts of vertical > spacing issues with beamer which I have not seen since I use 2.2. Yes, a spurious blank line may be harmful in latex. -- Enrico
diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 7332ec5..6de832d 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -2512,8 +2512,11 @@ bool BufferView::mouseSetCursor(Cursor & cur, bool select) // FIXME: (2) if we had a working InsetText::notifyCursorLeaves, // the leftinset bool would not be necessary (badcursor instead). bool update = leftinset; - if (!do_selection && d->cursor_.inTexted()) + if (!do_selection && d->cursor_.inTexted()) { update |= checkDepm(cur, d->cursor_); + if (cur.pos() && cur.paragraph().isEnvSeparator(cur.pos() - 1)) + cur.posBackward(); + } if (!do_selection) d->cursor_.resetAnchor();
diff --git a/src/Text3.cpp b/src/Text3.cpp index 0933000..a328fa9 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1048,22 +1048,11 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) case LFUN_CHAR_DELETE_FORWARD: if (!cur.selection()) { - bool was_separator = cur.paragraph().isEnvSeparator(cur.pos()); if (cur.pos() == cur.paragraph().size()) // Par boundary, force full-screen update singleParUpdate = false; needsUpdate |= erase(cur); cur.resetAnchor(); - if (was_separator && cur.pos() == cur.paragraph().size() - && (!cur.paragraph().layout().isEnvironment() - || cur.paragraph().size() > 0)) { - // Force full-screen update - singleParUpdate = false; - needsUpdate |= erase(cur); - cur.resetAnchor(); - } - // It is possible to make it a lot faster still - // just comment out the line below... } else { cutSelection(cur, true, false); singleParUpdate = false;