mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
fix selection bug, use istreambuf_iterator in lyxsum
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2071 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
23ea5a1b84
commit
a60753afd8
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
@ -53,6 +53,10 @@
|
||||
/* 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@
|
||||
|
||||
/************************************************************
|
||||
|
@ -272,6 +272,7 @@ fi
|
||||
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)
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -1,3 +1,7 @@
|
||||
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
|
||||
|
@ -20,10 +20,6 @@
|
||||
|
||||
#include "support/lyxlib.h"
|
||||
|
||||
using std::ifstream;
|
||||
using std::ios;
|
||||
using std::istream_iterator;
|
||||
|
||||
namespace {
|
||||
|
||||
// DO _NOT_ CHANGE _ANYTHING_ IN THIS TABLE
|
||||
@ -111,10 +107,18 @@ unsigned long do_crc(InputIterator first, InputIterator last)
|
||||
// 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;
|
||||
ifs.unsetf(ios::skipws);
|
||||
istream_iterator<char> beg(ifs);
|
||||
istream_iterator<char> end;
|
||||
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(std::ios::skipws);
|
||||
std::istream_iterator<char> beg(ifs);
|
||||
std::istream_iterator<char> end;
|
||||
return do_crc(beg, end);
|
||||
#endif
|
||||
}
|
||||
|
15
src/text2.C
15
src/text2.C
@ -1684,7 +1684,7 @@ void LyXText::CutSelection(BufferView * bview, bool doclear)
|
||||
// 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,
|
||||
@ -1692,7 +1692,6 @@ void LyXText::CutSelection(BufferView * bview, bool doclear)
|
||||
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,
|
||||
@ -1709,9 +1708,14 @@ void LyXText::CutSelection(BufferView * bview, bool doclear)
|
||||
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());
|
||||
@ -2197,7 +2201,8 @@ void LyXText::SetCurrentFont(BufferView * bview) const
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user