improve selection of range when using the errorlist dialog

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9994 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-06-03 08:48:04 +00:00
parent 38d438d993
commit 4fb36820b2
4 changed files with 26 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2005-06-02 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* buffer_funcs.C (bufferErrors): fix computation of the end of an
error range.
2005-05-31 Martin Vermeer <martin.vermeer@hut.fi>
* BufferView.[Ch] (update):

View File

@ -212,15 +212,19 @@ void bufferErrors(Buffer const & buf, TeXErrors const & terr)
TeXErrors::Errors::const_iterator end = terr.end();
for (; cit != end; ++cit) {
int par_id = -1;
int posstart = -1;
int const errorrow = cit->error_in_line;
buf.texrow().getIdFromRow(errorrow, par_id, posstart);
int posend = -1;
buf.texrow().getIdFromRow(errorrow + 1, par_id, posend);
buf.error(ErrorItem(cit->error_desc,
cit->error_text,
par_id, posstart, posend));
int id_start = -1;
int pos_start = -1;
int errorrow = cit->error_in_line;
buf.texrow().getIdFromRow(errorrow, id_start, pos_start);
int id_end = -1;
int pos_end = -1;
do {
++errorrow;
buf.texrow().getIdFromRow(errorrow, id_end, pos_end);
} while (id_start == id_end && pos_start == pos_end);
buf.error(ErrorItem(cit->error_desc, cit->error_text,
id_start, pos_start, pos_end));
}
}

View File

@ -1,3 +1,8 @@
2005-06-02 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* ControlErrorList.C (goTo): if pos_end is 0, assume it is the end
of the paragraph instead.
2005-05-14 Michael Schmitt <michael.schmitt@teststep.org>
* ControlLog.C: fix dialog title

View File

@ -70,7 +70,9 @@ void ControlErrorList::goTo(int item)
// Now make the selection.
// This should be implemented using an LFUN. (Angus)
pos_type const end = std::min(err.pos_end, pit->size());
// if pos_end is 0, this means it is end-of-paragraph
pos_type const end = err.pos_end ? std::min(err.pos_end, pit->size())
: pit->size();
pos_type const start = std::min(err.pos_start, end);
pos_type const range = end - start;
DocIterator const dit = makeDocIterator(pit, start);