+2001-05-30 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * acconfig.h: add entry for HAVE_DECL_ISTREAMBUF_ITERATOR
+
+ * configure.in: check for istreambuf_iterator in <iterator>
+
2001-05-16 Ruurd Reitsma <r.a.reitsma@wbmt.tudelft.nl>
* Added README.Win32
/* Define if you have the function prototype for vsnprintf(). */
#undef HAVE_DECL_VSNPRINTF
+/* Define if you have the function prototype istreambuf_iterator in
+ <iterator> */
+#undef HAVE_DECL_ISTREAMBUF_ITERATOR
+
@BOTTOM@
/************************************************************
AC_CHECK_FUNCS(snprintf vsnprintf)
LYX_CHECK_DECL(snprintf, stdio.h)
LYX_CHECK_DECL(vsnprintf, stdio.h)
+LYX_CHECK_DECL(istreambuf_iterator, iterator)
AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo \
mkstemp mktemp)
+2001-05-30 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * text2.C (CutSelection): make the cursor valid before the call to
+ ClearSelection.
+
2001-05-29 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* kbsequence.C (parse): de-uglify a bit the parsing code, which
+2001-05-30 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * lyxsum.C (sum): use istreambuf_iterator when available.
+
2001-05-29 Lars Gullik Bjønnes <larsbj@birdstep.com>
* lyxsum.C (sum): don't use sstream anymore, use istream_iterator
#include "support/lyxlib.h"
-using std::ifstream;
-using std::ios;
-using std::istream_iterator;
-
namespace {
// DO _NOT_ CHANGE _ANYTHING_ IN THIS TABLE
// And this would be the file interface.
unsigned long lyx::sum(string const & file)
{
- ifstream ifs(file.c_str());
+#ifdef HAVE_DECL_ISTREAMBUF_ITERATOR
+ std::ifstream ifs(file.c_str());
+ if (!ifs) return 0;
+ std::istreambuf_iterator<char> beg(ifs);
+ std::istreambuf_iterator<char> end;
+ return do_crc(beg, end);
+#else
+ std::ifstream ifs(file.c_str());
if (!ifs) return 0;
- ifs.unsetf(ios::skipws);
- istream_iterator<char> beg(ifs);
- istream_iterator<char> end;
+ ifs.unsetf(std::ios::skipws);
+ std::istream_iterator<char> beg(ifs);
+ std::istream_iterator<char> end;
return do_crc(beg, end);
+#endif
}
// more than one paragraph
if (sel_start_cursor.par() == sel_end_cursor.par()) {
// only within one paragraph
- endpar = sel_start_cursor.par();
+ endpar = sel_end_cursor.par();
int pos = sel_end_cursor.pos();
cap.cutSelection(sel_start_cursor.par(), &endpar,
sel_start_cursor.pos(), pos,
sel_end_cursor.pos(pos);
} else {
endpar = sel_end_cursor.par();
-
int pos = sel_end_cursor.pos();
cap.cutSelection(sel_start_cursor.par(), &endpar,
sel_start_cursor.pos(), pos,
sel_start_cursor.par()->StripLeadingSpaces(bview->buffer()->params.textclass);
RedoParagraphs(bview, sel_start_cursor, endpar);
-
- ClearSelection(bview);
+
+ // cutSelection can invalidate the cursor so we need to set
+ // it anew. (Lgb)
cursor = sel_start_cursor;
+
+ // need a valid cursor. (Lgb)
+ ClearSelection(bview);
+
SetCursor(bview, cursor.par(), cursor.pos());
sel_cursor = cursor;
UpdateCounters(bview, cursor.row());
if (pos > 0) {
if (pos == cursor.par()->size())
--pos;
- else if (cursor.par()->IsSeparator(pos)) {
+ else // potentional bug... BUG (Lgb)
+ if (cursor.par()->IsSeparator(pos)) {
if (pos > cursor.row()->pos() &&
bidi_level(pos) % 2 ==
bidi_level(pos - 1) % 2)