mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
alfredo's patch for 782 and 1020
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6732 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
cd56b9f3ae
commit
793b375202
@ -1,3 +1,7 @@
|
||||
2003-04-05 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* lyxfind.C (searchForward, searchBackwards): bug 782
|
||||
|
||||
2003-04-07 John Levon <levon@movementarian.org>
|
||||
|
||||
* paragraph.C: remove dead comment
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-04-05 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* insettabular.C (searchForward,searchBackward): fix bug 782
|
||||
|
||||
2003-04-07 John Levon <levon@movementarian.org>
|
||||
|
||||
* insettabular.C:
|
||||
|
@ -2720,6 +2720,7 @@ bool InsetTabular::nextChange(BufferView * bv, lyx::pos_type & length)
|
||||
bool InsetTabular::searchForward(BufferView * bv, string const & str,
|
||||
bool cs, bool mw)
|
||||
{
|
||||
int cell = 0;
|
||||
if (the_locking_inset) {
|
||||
if (the_locking_inset->searchForward(bv, str, cs, mw)) {
|
||||
updateLocal(bv, CELL);
|
||||
@ -2727,16 +2728,16 @@ bool InsetTabular::searchForward(BufferView * bv, string const & str,
|
||||
}
|
||||
if (tabular->IsLastCell(actcell))
|
||||
return false;
|
||||
++actcell;
|
||||
cell = actcell + 1;
|
||||
}
|
||||
InsetText * inset = tabular->GetCellInset(actcell);
|
||||
InsetText * inset = tabular->GetCellInset(cell);
|
||||
if (inset->searchForward(bv, str, cs, mw)) {
|
||||
updateLocal(bv, FULL);
|
||||
return true;
|
||||
}
|
||||
while (!tabular->IsLastCell(actcell)) {
|
||||
++actcell;
|
||||
inset = tabular->GetCellInset(actcell);
|
||||
while (!tabular->IsLastCell(cell)) {
|
||||
++cell;
|
||||
inset = tabular->GetCellInset(cell);
|
||||
if (inset->searchForward(bv, str, cs, mw)) {
|
||||
updateLocal(bv, FULL);
|
||||
return true;
|
||||
@ -2749,18 +2750,18 @@ bool InsetTabular::searchForward(BufferView * bv, string const & str,
|
||||
bool InsetTabular::searchBackward(BufferView * bv, string const & str,
|
||||
bool cs, bool mw)
|
||||
{
|
||||
int cell = tabular->GetNumberOfCells();
|
||||
if (the_locking_inset) {
|
||||
if (the_locking_inset->searchBackward(bv, str, cs, mw)) {
|
||||
updateLocal(bv, CELL);
|
||||
return true;
|
||||
}
|
||||
cell = actcell;
|
||||
}
|
||||
if (!locked)
|
||||
actcell = tabular->GetNumberOfCells();
|
||||
|
||||
while (actcell) {
|
||||
--actcell;
|
||||
InsetText * inset = tabular->GetCellInset(actcell);
|
||||
while (cell) {
|
||||
--cell;
|
||||
InsetText * inset = tabular->GetCellInset(cell);
|
||||
if (inset->searchBackward(bv, str, cs, mw)) {
|
||||
updateLocal(bv, CELL);
|
||||
return true;
|
||||
|
@ -143,6 +143,7 @@ bool LyXFind(BufferView * bv,
|
||||
// we are!
|
||||
LyXText * text = bv->text;
|
||||
|
||||
|
||||
if (text->selection.set())
|
||||
text->cursor = forward ?
|
||||
text->selection.end : text->selection.start;
|
||||
@ -233,27 +234,17 @@ SearchResult SearchForward(BufferView * bv, LyXText * text, string const & str,
|
||||
{
|
||||
Paragraph * par = text->cursor.par();
|
||||
pos_type pos = text->cursor.pos();
|
||||
Paragraph * prev_par = par;
|
||||
UpdatableInset * inset;
|
||||
|
||||
while (par && !IsStringInText(par, pos, str, cs, mw)) {
|
||||
if (par->isInset(pos) &&
|
||||
(inset = (UpdatableInset *)par->getInset(pos)) &&
|
||||
(inset->isTextInset()))
|
||||
{
|
||||
#if 0
|
||||
// lock the inset!
|
||||
text->setCursor(bv, par, pos);
|
||||
inset->edit(bv);
|
||||
#endif
|
||||
if (inset->searchForward(bv, str, cs, mw))
|
||||
return SR_FOUND_NOUPDATE;
|
||||
}
|
||||
if (pos < par->size()
|
||||
&& par->isInset(pos)
|
||||
&& (inset = (UpdatableInset *)par->getInset(pos))
|
||||
&& inset->isTextInset()
|
||||
&& inset->searchForward(bv, str, cs, mw))
|
||||
return SR_FOUND_NOUPDATE;
|
||||
|
||||
++pos;
|
||||
|
||||
if (pos >= par->size()) {
|
||||
prev_par = par;
|
||||
if (++pos >= par->size()) {
|
||||
par = par->next();
|
||||
pos = 0;
|
||||
}
|
||||
@ -262,12 +253,8 @@ SearchResult SearchForward(BufferView * bv, LyXText * text, string const & str,
|
||||
if (par) {
|
||||
text->setCursor(par, pos);
|
||||
return SR_FOUND;
|
||||
} else {
|
||||
// make sure we end up at the end of the text,
|
||||
// not the start point of the last search
|
||||
text->setCursor(prev_par, prev_par->size());
|
||||
} else
|
||||
return SR_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -280,13 +267,11 @@ SearchResult SearchBackward(BufferView * bv, LyXText * text,
|
||||
{
|
||||
Paragraph * par = text->cursor.par();
|
||||
pos_type pos = text->cursor.pos();
|
||||
Paragraph * prev_par = par;
|
||||
|
||||
do {
|
||||
if (pos > 0)
|
||||
--pos;
|
||||
else {
|
||||
prev_par = par;
|
||||
// We skip empty paragraphs (Asger)
|
||||
do {
|
||||
par = par->previous();
|
||||
@ -295,28 +280,18 @@ SearchResult SearchBackward(BufferView * bv, LyXText * text,
|
||||
} while (par && pos < 0);
|
||||
}
|
||||
UpdatableInset * inset;
|
||||
if (par && par->isInset(pos) &&
|
||||
(inset = (UpdatableInset *)par->getInset(pos)) &&
|
||||
(inset->isTextInset()))
|
||||
{
|
||||
#if 0
|
||||
// lock the inset!
|
||||
text->setCursor(bv, par, pos);
|
||||
inset->edit(bv, false);
|
||||
#endif
|
||||
if (inset->searchBackward(bv, str, cs, mw))
|
||||
return SR_FOUND_NOUPDATE;
|
||||
}
|
||||
if (par && par->isInset(pos)
|
||||
&& (inset = (UpdatableInset *)par->getInset(pos))
|
||||
&& inset->isTextInset()
|
||||
&& inset->searchBackward(bv, str, cs, mw))
|
||||
return SR_FOUND_NOUPDATE;
|
||||
} while (par && !IsStringInText(par, pos, str, cs, mw));
|
||||
|
||||
if (par) {
|
||||
text->setCursor(par, pos);
|
||||
return SR_FOUND;
|
||||
} else {
|
||||
// go to the last part of the unsuccessful search
|
||||
text->setCursor(prev_par, 0);
|
||||
} else
|
||||
return SR_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user