On Wed, Dec 12, 2001 at 11:17:34AM +0100, Jean-Marc Lasgouttes wrote: > John> uh, yeah, I think so - it must have been left in from a previous > John> attempt to do it slightly differently. So I don't think we need > John> prev_pos at all, we can always do prev_par->size() in the > John> setCursor call on fail case. > > Could you do that?
attached, looks to work, but there are some mechanism problems with find (we all know what mechanism I mean ;) : If I have : >|< >efefefwfwefwefwef< then when I do find for nothing from the empty line, it is deleted, but the lyx display isn't updated. This problem is more worrying with the attached lyx file (again add empty para at the start then search, as the WRONG para is deleted !) regards john -- "Take the ideas you find useful. Try not to get hung up on the labels." - Jonathan S. Shapiro
#LyX 1.2 created this file. For more info see http://www.lyx.org/ \lyxformat 220 \textclass article \language english \inputencoding auto \fontscheme default \graphics default \paperfontsize default \spacing single \papersize Default \paperpackage a4 \use_geometry 0 \use_amsmath 0 \use_natbib 0 \use_numerical_citations 0 \paperorientation portrait \secnumdepth 3 \tocdepth 3 \paragraph_separation skip \defskip medskip \quotes_language english \quotes_times 2 \papercolumns 1 \papersides 1 \paperpagestyle default \layout Standard blah blah blah \layout Standard \begin_inset Tabular <lyxtabular version="2" rows="5" columns="5"> <features rotate="false" islongtable="false" endhead="0" endfirsthead="0" endfoot="0" endlastfoot="0"> <column alignment="center" valignment="top" leftline="true" rightline="false" width="" special=""> <column alignment="center" valignment="top" leftline="true" rightline="false" width="" special=""> <column alignment="center" valignment="top" leftline="true" rightline="false" width="" special=""> <column alignment="center" valignment="top" leftline="true" rightline="false" width="" special=""> <column alignment="center" valignment="top" leftline="true" rightline="true" width="" special=""> <row topline="true" bottomline="true" newpage="false"> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard some \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard table \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> </row> <row topline="true" bottomline="false" newpage="false"> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> </row> <row topline="true" bottomline="false" newpage="false"> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> </row> <row topline="true" bottomline="false" newpage="false"> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> </row> <row topline="true" bottomline="true" newpage="false"> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="false" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> <cell multicolumn="0" alignment="center" valignment="top" topline="true" bottomline="false" leftline="true" rightline="true" rotate="false" usebox="none" width="" special=""> \begin_inset Text \layout Standard \end_inset </cell> </row> </lyxtabular> \end_inset . OK - search from \begin_inset Quotes eld \end_inset blah \begin_inset Quotes erd \end_inset start for something not here. \layout Standard You will find after finishing the search, it ends up at the start of the table again. \layout Standard Works in reverse too. bug #457396. \the_end
Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.455 diff -u -r1.455 ChangeLog --- src/ChangeLog 2001/12/11 17:26:50 1.455 +++ src/ChangeLog 2001/12/12 10:41:17 @@ -1,3 +1,7 @@ +2001-12-12 John Levon <[EMAIL PROTECTED]> + + * lyxfind.C: clean up of find failure position change + 2001-12-10 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> * tabular-old.C (getTokenValue): Index: src/lyxfind.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfind.C,v retrieving revision 1.20 diff -u -r1.20 lyxfind.C --- src/lyxfind.C 2001/12/10 12:50:08 1.20 +++ src/lyxfind.C 2001/12/12 10:41:17 @@ -225,7 +225,6 @@ Paragraph * par = text->cursor.par(); pos_type pos = text->cursor.pos(); Paragraph * prev_par = par; - pos_type prev_pos; UpdatableInset * inset; while (par && !IsStringInText(par, pos, str, cs, mw)) { @@ -245,8 +244,6 @@ if (pos >= par->size()) { prev_par = par; - // consider 0-sized empty pars - prev_pos = std::min(pos, par->size()); par = par->next(); pos = 0; } @@ -258,7 +255,7 @@ } else { // make sure we end up at the end of the text, // not the start point of the last search - text->setCursor(bv, prev_par, prev_pos); + text->setCursor(bv, prev_par, prev_par->size()); return SR_NOT_FOUND; } } @@ -274,13 +271,11 @@ Paragraph * par = text->cursor.par(); pos_type pos = text->cursor.pos(); Paragraph * prev_par = par; - pos_type prev_pos = pos; do { if (pos > 0) --pos; else { - prev_pos = pos; prev_par = par; // We skip empty paragraphs (Asger) do { @@ -308,7 +303,7 @@ return SR_FOUND; } else { // go to the last part of the unsuccessful search - text->setCursor(bv, prev_par, prev_pos); + text->setCursor(bv, prev_par, 0); return SR_NOT_FOUND; } }