inside floats etc.
Works ok for .lyx bad tokens.
For some reason, latex errors are still filed (and then placed) under
top-paragraphs.
If someone wants to have a look at that... (Jose'?). Should be easy to fix
if one knows where ;-)
Alfredo
Index: paragraph_funcs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph_funcs.C,v
retrieving revision 1.85
diff -u -p -u -r1.85 paragraph_funcs.C
--- paragraph_funcs.C 5 Nov 2003 12:06:04 -0000 1.85
+++ paragraph_funcs.C 6 Nov 2003 10:13:25 -0000
@@ -369,8 +369,7 @@ int readParToken(Buffer & buf, Paragraph
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
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;
Index: frontends/controllers/ControlErrorList.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlErrorList.C,v
retrieving revision 1.15
diff -u -p -u -r1.15 ControlErrorList.C
--- frontends/controllers/ControlErrorList.C 9 Oct 2003 10:52:10 -0000 1.15
+++ frontends/controllers/ControlErrorList.C 6 Nov 2003 10:13:26 -0000
@@ -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);
}