Continuing with a series of semi-infuriating navigation and selection 
issues.

When starting a selection inside an inset (e.g. footnote) and extending to 
the outside with shift-arrow keys, the selection correctly includes the 
inset atomically. However, then it is impossible to re-enter the inset while 
selecting, so exiting is irreversible.
This can be highly frustrating when editing e.g. complex formulae; a small 
mistake and you exit the math inset and have to restart the selection from 
scratch.
This works correctly *inside* mathed (you can reenter the inset where the 
anchor is), so this behaviour is what the user would expect also in texted.
When selecting with the mouse, everything's fine, i.e. you can reenter the 
inset.

A proposed fix is in attachment. Seems suspiciously simple... I'm worried of 
course that it may introduce other issues (although from a quick test I 
didn't see any). Could not test with tables because of #9291.

A/
diff --git a/src/Text2.cpp b/src/Text2.cpp
index 33fcef16..f9d852c 100644
--- a/src/Text2.cpp
+++ b/src/Text2.cpp
@@ -592,13 +592,13 @@ void Text::setCursorIntern(Cursor & cur,
 
 bool Text::checkAndActivateInset(Cursor & cur, bool front)
 {
-	if (cur.selection())
-		return false;
 	if (front && cur.pos() == cur.lastpos())
 		return false;
 	if (!front && cur.pos() == 0)
 		return false;
 	Inset * inset = front ? cur.nextInset() : cur.prevInset();
+	if (cur.selection() && cur.realAnchor().find(inset) == -1)
+		return false;
 	if (!inset || !inset->editable())
 		return false;
 	/*
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index 609de70..1e2a36a 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -251,7 +251,7 @@ void InsetText::edit(Cursor & cur, bool front, EntryDirection entry_from)
 	}
 
 	text_.setCursor(cur.top(), pit, pos);
-	cur.clearSelection();
+	//cur.clearSelection();
 	cur.finishUndo();
 }
 

Reply via email to