finer error handling

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8054 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Alfredo Braunstein 2003-11-06 10:52:15 +00:00
parent f7a9c1a6be
commit 338b173b3c
4 changed files with 14 additions and 15 deletions

View File

@ -2,6 +2,8 @@
* lyxfind.C (replaceAll): mark the buffer dirty if something was
replaced
* paragraph_funcs.C (readParToken): put the correct id in the
error item, not the id of the top paragraph
2003-11-06 Alfredo Braunstein <abraunst@libero.it>

View File

@ -1,3 +1,6 @@
2003-11-06 Alfredo Braunstein <abraunst@libero.it>
* ControlErrorList.C (goTo): allow going to inner paragraphs
2003-11-04 Alfredo Braunstein <abraunst@libero.it>

View File

@ -13,10 +13,12 @@
#include "ControlErrorList.h"
#include "buffer.h"
#include "BufferView.h"
#include "bufferview_funcs.h"
#include "debug.h"
#include "iterators.h"
#include "lyxtext.h"
#include "paragraph.h"
#include "PosIterator.h"
using std::endl;
@ -67,17 +69,11 @@ void ControlErrorList::goTo(int item)
return;
}
int range = err.pos_end - err.pos_start;
if (err.pos_end > pit->size() || range <= 0)
range = pit->size() - err.pos_start;
int const end = std::min(err.pos_end, pit->size());
int const start = std::min(err.pos_start, end);
int const range = end - start;
// Now make the selection.
BufferView * const bv = kernel().bufferview();
bv->insetUnlock();
bv->text->clearSelection();
bv->text->setCursor(pit.pit(), err.pos_start);
bv->text->setSelectionRange(range);
bv->fitCursor();
bv->update();
PosIterator const pos = pit.asPosIterator(start);
bv_funcs::put_selection_at(kernel().bufferview(), pos, range, false);
}

View File

@ -369,8 +369,7 @@ int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & tok
lex.eatLine();
string line = lex.getString();
buf.error(ErrorItem(_("Unknown Inset"), line,
buf.paragraphs().back().id(),
0, par.size()));
par.id(), 0, par.size()));
return 1;
}
} else if (token == "\\family") {
@ -498,8 +497,7 @@ int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & tok
token, lex.getString());
buf.error(ErrorItem(_("Unknown token"), s,
buf.paragraphs().back().id(),
0, par.size()));
par.id(), 0, par.size()));
return 1;
}
return 0;