http://bugzilla.lyx.org/show_bug.cgi?id=2510

This happens because the is no \change_unchanged at the end of the
not inset. 

The code in findnextchange looks like

        for (; cur != et ; cur.forwardPosNoDescend()) {
                Change change = cur.paragraph().lookupChangeFull(cur.pos());
                if (change != orig_change) {
                        break;
                }
        }

However, forwardPosNoDescend does not go out of an inset when at the end
of this inset, which does not seem to be by design (but who knows?), and
therefore the cursor gets stuck forever at the end of the note inset.

The proposed patch fixes this. I looked at other uses of
forwardPosNoDescend (in text2.C and insetcollapsable.C) and none of
them can trigger this particular condition. Therefore I think it safe
to change the method semantics.

Testing and comments appreciated. I am not sure it is possible to
reproduce the bug with a new document, it may be due to older LyX bug.
I attach a short document extracted from the original bug report.

JMarc

Index: src/dociterator.C
===================================================================
--- src/dociterator.C	(revision 14615)
+++ src/dociterator.C	(working copy)
@@ -398,7 +398,11 @@ void DocIterator::forwardPosNoDescend()
 	}
 	//lyxerr << "... no next idx" << endl;
 
-	// otherwise we can't move on
+	// otherwise leave inset and jump over inset as a whole
+	pop_back();
+	// 'top' is invalid now...
+	if (!empty())
+		++top().pos();
 }
 
 
#LyX 1.4.3svn created this file. For more info see http://www.lyx.org/
\lyxformat 245
\begin_document
\begin_header
\textclass elsart
\begin_preamble
%%%%%%%%%%%%% Brian Larsen  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% [EMAIL PROTECTED] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% last modified:          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% larsen - 20march2006    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%% various physics constants %%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\rearth}{ \textnormal{R} _{\textnormal{E}}}
%%\usepackage[thickqspace,thickspace,amssymb]{SIunits}
\end_preamble
\language english
\inputencoding auto
\fontscheme times
\graphics default
\paperfontsize default
\spacing other 2
\papersize letterpaper
\use_geometry false
\use_amsmath 1
\cite_engine natbib_authoryear
\use_bibtopic false
\paperorientation portrait
\leftmargin 1in
\topmargin 1in
\rightmargin 1in
\bottommargin 1in
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes true
\output_changes true
\author "Jean-Marc Lasgouttes" 
\author "Brian Larsen" [EMAIL PROTECTED]
\author "chris" 
\end_header

\begin_body

\begin_layout Standard
 As the plasmasphere is the innermost section of the magnetosphere the whole
 magnetosphere must reorganize in order for the plasmasphere to react
\begin_inset Note Note
status open

\begin_layout Standard

\change_inserted 2 1144813509
I know what you are trying to say here but to make a statment like that
 you need to back it up with a reference.
 There are so many varaibles that this may not be true.
 It seems logical but very broad.
 I would just nuke it.
\change_unchanged 
\end_layout

\end_inset

.
 
\change_inserted 2 1144813509
A 
\change_deleted 2 1144813509
The
\change_unchanged
 
\end_layout

\end_body
\end_document

Reply via email to