[EMAIL PROTECTED] writes:

> Author: lasgouttes
> Date: Mon Jan 28 11:50:24 2008
> New Revision: 22695
>
> URL: http://www.lyx.org/trac/changeset/22695
> Log:
>       * src/Text.cpp (changeCase): do not set the selection if it was not 
>       already set.
>
>       * src/Paragraph.cpp (changeCase): make sure to update the selection 
>       as needed.

Juergen, this was reported by G. Milde back in November. The branch
version is simpler than the trunk one.

OK?

JMarc

svndiff src/Text.cpp

Index: src/Text.cpp
===================================================================
--- src/Text.cpp	(revision 22694)
+++ src/Text.cpp	(working copy)
@@ -1088,9 +1088,11 @@ void Text::changeCase(Cursor & cur, Text
 	CursorSlice from;
 	CursorSlice to;
 
+	bool gotsel = false;
 	if (cur.selection()) {
 		from = cur.selBegin();
 		to = cur.selEnd();
+		gotsel = true;
 	} else {
 		from = cur.top();
 		getWord(from, to, PARTIAL_WORD);
@@ -1174,10 +1176,13 @@ void Text::changeCase(Cursor & cur, Text
 	}
 
 	// the selection may have changed due to logically-only deleted chars
-	setCursor(cur, begPit, begPos);
-	cur.resetAnchor();
-	setCursor(cur, endPit, right);
-	cur.setSelection();
+	if (gotsel) {
+		setCursor(cur, begPit, begPos);
+		cur.resetAnchor();
+		setCursor(cur, endPit, right);
+		cur.setSelection();
+	} else
+		setCursor(cur, endPit, right);
 
 	checkBufferStructure(cur.buffer(), cur);
 }

Reply via email to