>>>>> "Juergen" == Juergen Spitzmueller <[EMAIL PROTECTED]> writes:

Juergen> Juergen Spitzmueller wrote:
>> I have adapted the patch to current cvs (see attached).

Juergen> After some more testing, I came up with the attached,
Juergen> slightly improved version, which does also respect inlined
Juergen> (as well opened) insets (i.e. does not force inlined ERTs to
Juergen> opened ones when the cursor enters, which btw also s&r
Juergen> currently does, due to André's change below). The only
Juergen> difference to the prior patch is the change in status().

Hello Juergen,

Since the auto-open feature is a `big' change, code-wise (should
auto-open be a property of the cursor or of the inset?) and UI-wise
(do I want closed footnotes to pop-up on me when I do char-forward?),
I propose a much less ambitious patch.

I removes André's patch as you did, but for the reason that everything
is done in BufferView::setCursor now. Although I took the occasion to
use the same code that André used (on the premise that he knows what
he does), the main fix in the patch is to remove a use of cursor()
where dit should have been used instead.

As far as I know this fixes 1921, but I'd be interested to see what
was André's patch supposed to fix, to check that I did not break
anything.

JMarc

Index: src/BufferView.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.C,v
retrieving revision 1.263
diff -u -p -r1.263 BufferView.C
--- src/BufferView.C	15 Jul 2005 22:10:15 -0000	1.263
+++ src/BufferView.C	22 Sep 2005 10:28:14 -0000
@@ -323,12 +323,12 @@ LyXText * BufferView::text() const
 
 void BufferView::setCursor(DocIterator const & dit)
 {
-	size_t const n = dit.depth();
-	for (size_t i = 0; i < n; ++i)
-		dit[i].inset().edit(cursor(), true);
-
 	cursor().setCursor(dit);
 	cursor().selection() = false;
+	// Open all collapsed insets
+	for (int i = cursor().depth() - 1; i >= 0; --i)
+		cursor()[i].inset().setStatus(cursor(), InsetBase::Open);
+
 }
 
 
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.2288
diff -u -p -r1.2288 ChangeLog
--- src/ChangeLog	21 Sep 2005 13:18:14 -0000	1.2288
+++ src/ChangeLog	22 Sep 2005 10:28:15 -0000
@@ -1,3 +1,12 @@
+2005-09-22  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* cursor.C (setSelection): do not open collapsable insets; this is
+	done in the only caller (BufferView::putSelection) by a call to
+	BufferView::setCursor. 
+
+	* BufferView.C (setCursor): open correctly collapsable insets.
+	(bug 1921)
+
 2005-09-12  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* lyxfunc.C (sendDispatchMessage): do not update menubar/toolbar
Index: src/cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.C,v
retrieving revision 1.135
diff -u -p -r1.135 cursor.C
--- src/cursor.C	21 Sep 2005 09:56:54 -0000	1.135
+++ src/cursor.C	22 Sep 2005 10:28:15 -0000
@@ -468,9 +468,6 @@ void LCursor::setSelection(DocIterator c
 	selection() = true;
 	anchor_ = where;
 	pos() += n;
-	// Open all collapsed insets
-	for (int i = depth() - 1; i >= 0; --i)
-		operator[](i).inset().setStatus(*this, InsetBase::Open);
 }
 
 

Reply via email to