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

Juergen> Jean-Marc Lasgouttes wrote:
>> They are supposed to just take the needed space, right? This is
>> particularly annoying with ERT, which is expected to be small.

Juergen> Yes. Note, however, that it only happens with empty
Juergen> collapsables in new paragraphs. Annoying still.

This is because the rowpainter code sets Wide() on these insets,
because they are alone on a row. The following patches test
additionally that the inset is not the last element of the paragraph.
It seems to work for me, but I am not sure it is the right condition
to test.

Martin?

JMarc

Index: src/rowpainter.C
===================================================================
--- src/rowpainter.C	(revision 14240)
+++ src/rowpainter.C	(working copy)
@@ -763,8 +763,9 @@ bool CursorOnRow(PainterInfo & pi, pit_t
 bool innerCursorOnRow(PainterInfo & pi, pit_type pit, 
 	RowList::const_iterator rit, LyXText const & text)
 {
-	// Is there a cursor inside an inset on this row, and is this inset
-	// the only "character" on this row
+	// Is there a cursor inside an inset on this row, and is this
+	// inset the only "character" on this row, but not the last of
+	// the paragraph.
 	LCursor & cur = pi.base.bv->cursor();
 	if (rit->pos() + 1 != rit->endpos())
 		return false;
@@ -772,7 +773,8 @@ bool innerCursorOnRow(PainterInfo & pi, 
 		CursorSlice const & sl = cur[d];
 		if (sl.text() == &text
 		    && sl.pit() == pit 
-		    && sl.pos() == rit->pos())
+		    && sl.pos() == rit->pos()
+		    && sl.pos() < sl.lastpos() - 1)
 			return d < cur.depth() - 1;
 	}
 	return false;
Index: src/rowpainter.C
===================================================================
--- src/rowpainter.C	(revision 14240)
+++ src/rowpainter.C	(working copy)
@@ -766,8 +766,9 @@ bool CursorOnRow(PainterInfo & pi, pit_t
 bool innerCursorOnRow(PainterInfo & pi, pit_type pit,
 	RowList::const_iterator rit, LyXText const & text)
 {
-	// Is there a cursor inside an inset on this row, and is this inset
-	// the only "character" on this row
+	// Is there a cursor inside an inset on this row, and is this
+	// inset the only "character" on this row, but not the last of
+	// the paragraph.
 	LCursor & cur = pi.base.bv->cursor();
 	if (rit->pos() + 1 != rit->endpos())
 		return false;
@@ -775,7 +776,8 @@ bool innerCursorOnRow(PainterInfo & pi, 
 		CursorSlice const & sl = cur[d];
 		if (sl.text() == &text
 		    && sl.pit() == pit
-		    && sl.pos() == rit->pos())
+		    && sl.pos() == rit->pos()
+		    && sl.pos() < sl.lastpos() - 1)
 			return d < cur.depth() - 1;
 	}
 	return false;

Reply via email to