2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
|
* \file lyxfind.cpp
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author J<EFBFBD>rgen Vigna
|
2003-11-04 12:01:15 +00:00
|
|
|
|
* \author Alfredo Braunstein
|
2003-08-23 00:17:00 +00:00
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
2001-03-06 10:20:33 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "lyxfind.h"
|
2003-09-09 22:13:45 +00:00
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Buffer.h"
|
2007-10-18 11:51:17 +00:00
|
|
|
|
#include "BufferParams.h"
|
2007-04-26 14:56:30 +00:00
|
|
|
|
#include "Cursor.h"
|
2004-03-25 09:16:36 +00:00
|
|
|
|
#include "CutAndPaste.h"
|
2006-12-29 23:54:48 +00:00
|
|
|
|
#include "buffer_funcs.h"
|
2003-09-09 22:13:45 +00:00
|
|
|
|
#include "BufferView.h"
|
2007-10-18 15:29:51 +00:00
|
|
|
|
#include "Changes.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "FuncRequest.h"
|
2007-04-29 23:33:02 +00:00
|
|
|
|
#include "Text.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Paragraph.h"
|
|
|
|
|
#include "ParIterator.h"
|
2003-09-09 22:13:45 +00:00
|
|
|
|
|
2007-04-28 20:44:46 +00:00
|
|
|
|
#include "frontends/alert.h"
|
2003-09-09 22:13:45 +00:00
|
|
|
|
|
2005-01-06 16:39:35 +00:00
|
|
|
|
#include "support/convert.h"
|
2008-02-18 07:14:42 +00:00
|
|
|
|
#include "support/debug.h"
|
2006-12-10 11:52:46 +00:00
|
|
|
|
#include "support/docstream.h"
|
2008-02-18 07:14:42 +00:00
|
|
|
|
#include "support/gettext.h"
|
2007-11-13 23:50:28 +00:00
|
|
|
|
#include "support/lstrings.h"
|
2003-09-09 22:13:45 +00:00
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
|
using namespace std;
|
2007-12-12 18:57:56 +00:00
|
|
|
|
using namespace lyx::support;
|
2007-12-12 10:16:00 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
2004-01-07 17:00:03 +00:00
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
2006-12-10 11:52:46 +00:00
|
|
|
|
bool parse_bool(docstring & howto)
|
2004-01-07 17:00:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (howto.empty())
|
|
|
|
|
return false;
|
2006-12-10 11:52:46 +00:00
|
|
|
|
docstring var;
|
2004-01-07 17:00:03 +00:00
|
|
|
|
howto = split(howto, var, ' ');
|
|
|
|
|
return (var == "1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-12-12 19:28:07 +00:00
|
|
|
|
class MatchString : public binary_function<Paragraph, pos_type, bool>
|
2003-07-27 12:02:58 +00:00
|
|
|
|
{
|
2003-11-04 12:01:15 +00:00
|
|
|
|
public:
|
2006-12-10 11:52:46 +00:00
|
|
|
|
MatchString(docstring const & str, bool cs, bool mw)
|
2004-01-07 14:07:46 +00:00
|
|
|
|
: str(str), cs(cs), mw(mw)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
// returns true if the specified string is at the specified position
|
2007-06-10 15:07:21 +00:00
|
|
|
|
// del specifies whether deleted strings in ct mode will be considered
|
|
|
|
|
bool operator()(Paragraph const & par, pos_type pos, bool del = true) const
|
2004-01-07 17:00:03 +00:00
|
|
|
|
{
|
2007-10-24 08:22:26 +00:00
|
|
|
|
return par.find(str, cs, mw, pos, del);
|
2003-07-27 12:02:58 +00:00
|
|
|
|
}
|
2004-01-26 17:00:09 +00:00
|
|
|
|
|
2003-11-04 12:01:15 +00:00
|
|
|
|
private:
|
2004-01-07 14:07:46 +00:00
|
|
|
|
// search string
|
2006-12-10 11:52:46 +00:00
|
|
|
|
docstring str;
|
2004-01-07 14:07:46 +00:00
|
|
|
|
// case sensitive
|
2003-11-04 12:01:15 +00:00
|
|
|
|
bool cs;
|
2004-01-07 14:07:46 +00:00
|
|
|
|
// match whole words only
|
2003-11-04 12:01:15 +00:00
|
|
|
|
bool mw;
|
|
|
|
|
};
|
2003-07-27 12:02:58 +00:00
|
|
|
|
|
|
|
|
|
|
2007-06-10 15:07:21 +00:00
|
|
|
|
bool findForward(DocIterator & cur, MatchString const & match,
|
|
|
|
|
bool find_del = true)
|
2001-03-06 10:20:33 +00:00
|
|
|
|
{
|
2004-04-01 08:58:45 +00:00
|
|
|
|
for (; cur; cur.forwardChar())
|
2007-06-10 15:07:21 +00:00
|
|
|
|
if (cur.inTexted() &&
|
|
|
|
|
match(cur.paragraph(), cur.pos(), find_del))
|
2003-11-17 09:02:10 +00:00
|
|
|
|
return true;
|
|
|
|
|
return false;
|
2003-11-04 12:01:15 +00:00
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-08-13 10:09:50 +00:00
|
|
|
|
|
2007-06-10 15:07:21 +00:00
|
|
|
|
bool findBackwards(DocIterator & cur, MatchString const & match,
|
|
|
|
|
bool find_del = true)
|
2003-11-04 12:01:15 +00:00
|
|
|
|
{
|
2004-09-17 16:28:47 +00:00
|
|
|
|
while (cur) {
|
|
|
|
|
cur.backwardChar();
|
2007-06-10 15:07:21 +00:00
|
|
|
|
if (cur.inTexted() &&
|
|
|
|
|
match(cur.paragraph(), cur.pos(), find_del))
|
2003-11-17 09:02:10 +00:00
|
|
|
|
return true;
|
2004-09-17 16:28:47 +00:00
|
|
|
|
}
|
2003-11-17 09:02:10 +00:00
|
|
|
|
return false;
|
2003-11-04 12:01:15 +00:00
|
|
|
|
}
|
2003-03-19 14:45:22 +00:00
|
|
|
|
|
2003-11-04 12:01:15 +00:00
|
|
|
|
|
2004-03-31 19:11:56 +00:00
|
|
|
|
bool findChange(DocIterator & cur)
|
2003-11-04 12:01:15 +00:00
|
|
|
|
{
|
2006-03-11 13:31:41 +00:00
|
|
|
|
for (; cur; cur.forwardPos())
|
2006-10-23 16:25:29 +00:00
|
|
|
|
if (cur.inTexted() && !cur.paragraph().isUnchanged(cur.pos()))
|
2003-11-17 09:02:10 +00:00
|
|
|
|
return true;
|
|
|
|
|
return false;
|
2001-03-06 10:20:33 +00:00
|
|
|
|
}
|
2002-06-24 20:28:12 +00:00
|
|
|
|
|
2001-03-06 10:20:33 +00:00
|
|
|
|
|
2007-10-20 17:35:27 +00:00
|
|
|
|
bool searchAllowed(BufferView * /*bv*/, docstring const & str)
|
2001-03-06 10:20:33 +00:00
|
|
|
|
{
|
2003-11-04 12:01:15 +00:00
|
|
|
|
if (str.empty()) {
|
2007-11-13 23:50:28 +00:00
|
|
|
|
frontend::Alert::error(_("Search error"), _("Search string is empty"));
|
2001-07-20 14:18:48 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2007-08-21 13:03:55 +00:00
|
|
|
|
return true;
|
2001-03-06 10:20:33 +00:00
|
|
|
|
}
|
2002-06-24 20:28:12 +00:00
|
|
|
|
|
2003-11-10 09:06:48 +00:00
|
|
|
|
|
2007-11-13 23:50:28 +00:00
|
|
|
|
bool find(BufferView * bv, docstring const & searchstr,
|
|
|
|
|
bool cs, bool mw, bool fw, bool find_del = true)
|
2002-06-18 15:44:30 +00:00
|
|
|
|
{
|
2003-11-04 12:01:15 +00:00
|
|
|
|
if (!searchAllowed(bv, searchstr))
|
|
|
|
|
return false;
|
|
|
|
|
|
2004-03-31 19:11:56 +00:00
|
|
|
|
DocIterator cur = bv->cursor();
|
2002-06-18 15:44:30 +00:00
|
|
|
|
|
2003-11-17 09:02:10 +00:00
|
|
|
|
MatchString const match(searchstr, cs, mw);
|
|
|
|
|
|
2007-06-10 15:07:21 +00:00
|
|
|
|
bool found = fw ? findForward(cur, match, find_del) :
|
|
|
|
|
findBackwards(cur, match, find_del);
|
2003-11-17 09:02:10 +00:00
|
|
|
|
|
2003-11-04 12:01:15 +00:00
|
|
|
|
if (found)
|
2004-01-14 17:21:39 +00:00
|
|
|
|
bv->putSelectionAt(cur, searchstr.length(), !fw);
|
2002-06-18 15:44:30 +00:00
|
|
|
|
|
2003-11-04 12:01:15 +00:00
|
|
|
|
return found;
|
2002-06-18 15:44:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-03-04 09:27:27 +00:00
|
|
|
|
|
2003-11-04 12:01:15 +00:00
|
|
|
|
int replaceAll(BufferView * bv,
|
2006-12-10 11:52:46 +00:00
|
|
|
|
docstring const & searchstr, docstring const & replacestr,
|
2003-11-04 12:01:15 +00:00
|
|
|
|
bool cs, bool mw)
|
2003-02-08 19:18:01 +00:00
|
|
|
|
{
|
2007-08-21 13:03:55 +00:00
|
|
|
|
Buffer & buf = bv->buffer();
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
2003-11-04 12:01:15 +00:00
|
|
|
|
if (!searchAllowed(bv, searchstr) || buf.isReadonly())
|
|
|
|
|
return 0;
|
2004-01-26 17:00:09 +00:00
|
|
|
|
|
2007-10-18 11:51:17 +00:00
|
|
|
|
bv->cursor().recordUndoFullDocument();
|
2004-01-26 17:00:09 +00:00
|
|
|
|
|
2003-11-17 09:02:10 +00:00
|
|
|
|
MatchString const match(searchstr, cs, mw);
|
2003-11-04 12:01:15 +00:00
|
|
|
|
int num = 0;
|
|
|
|
|
|
|
|
|
|
int const rsize = replacestr.size();
|
|
|
|
|
int const ssize = searchstr.size();
|
2003-11-17 09:02:10 +00:00
|
|
|
|
|
2004-04-01 08:58:45 +00:00
|
|
|
|
DocIterator cur = doc_iterator_begin(buf.inset());
|
2007-06-10 15:07:21 +00:00
|
|
|
|
while (findForward(cur, match, false)) {
|
2006-10-21 00:16:43 +00:00
|
|
|
|
pos_type pos = cur.pos();
|
2007-04-29 18:17:15 +00:00
|
|
|
|
Font const font
|
2004-03-25 09:16:36 +00:00
|
|
|
|
= cur.paragraph().getFontSettings(buf.params(), pos);
|
2006-10-22 14:36:08 +00:00
|
|
|
|
int striked = ssize - cur.paragraph().eraseChars(pos, pos + ssize,
|
2006-10-20 13:16:15 +00:00
|
|
|
|
buf.params().trackChanges);
|
2006-12-10 11:52:46 +00:00
|
|
|
|
cur.paragraph().insert(pos, replacestr, font,
|
2007-05-28 22:27:45 +00:00
|
|
|
|
Change(buf.params().trackChanges ?
|
|
|
|
|
Change::INSERTED : Change::UNCHANGED));
|
2004-03-25 09:16:36 +00:00
|
|
|
|
for (int i = 0; i < rsize + striked; ++i)
|
|
|
|
|
cur.forwardChar();
|
2003-11-04 12:01:15 +00:00
|
|
|
|
++num;
|
|
|
|
|
}
|
2003-11-17 09:02:10 +00:00
|
|
|
|
|
2006-12-29 23:54:48 +00:00
|
|
|
|
updateLabels(buf);
|
2004-04-01 08:58:45 +00:00
|
|
|
|
bv->putSelectionAt(doc_iterator_begin(buf.inset()), 0, false);
|
2003-11-06 10:10:43 +00:00
|
|
|
|
if (num)
|
|
|
|
|
buf.markDirty();
|
2003-11-04 12:01:15 +00:00
|
|
|
|
return num;
|
|
|
|
|
}
|
2003-04-16 00:39:24 +00:00
|
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
2006-12-10 11:52:46 +00:00
|
|
|
|
bool stringSelected(BufferView * bv, docstring const & searchstr,
|
2003-11-17 09:02:10 +00:00
|
|
|
|
bool cs, bool mw, bool fw)
|
|
|
|
|
{
|
|
|
|
|
// if nothing selected or selection does not equal search
|
|
|
|
|
// string search and select next occurance and return
|
2006-12-10 11:52:46 +00:00
|
|
|
|
docstring const & str1 = searchstr;
|
|
|
|
|
docstring const str2 = bv->cursor().selectionAsString(false);
|
2007-03-02 16:52:49 +00:00
|
|
|
|
if ((cs && str1 != str2) || compare_no_case(str1, str2) != 0) {
|
2003-11-17 09:02:10 +00:00
|
|
|
|
find(bv, searchstr, cs, mw, fw);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-12-10 11:52:46 +00:00
|
|
|
|
int replace(BufferView * bv, docstring const & searchstr,
|
|
|
|
|
docstring const & replacestr, bool cs, bool mw, bool fw)
|
2003-11-04 12:01:15 +00:00
|
|
|
|
{
|
2007-08-21 13:03:55 +00:00
|
|
|
|
if (!searchAllowed(bv, searchstr) || bv->buffer().isReadonly())
|
2003-11-04 12:01:15 +00:00
|
|
|
|
return 0;
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
2003-11-17 09:02:10 +00:00
|
|
|
|
if (!stringSelected(bv, searchstr, cs, mw, fw))
|
|
|
|
|
return 0;
|
|
|
|
|
|
2007-04-26 14:56:30 +00:00
|
|
|
|
Cursor & cur = bv->cursor();
|
2006-12-10 11:52:46 +00:00
|
|
|
|
cap::replaceSelectionWithString(cur, replacestr, fw);
|
2007-08-21 13:03:55 +00:00
|
|
|
|
bv->buffer().markDirty();
|
2007-06-10 15:07:21 +00:00
|
|
|
|
find(bv, searchstr, cs, mw, fw, false);
|
2007-12-21 20:42:46 +00:00
|
|
|
|
bv->buffer().updateMacros();
|
2007-10-10 08:52:55 +00:00
|
|
|
|
bv->processUpdateFlags(Update::Force | Update::FitCursor);
|
2004-01-26 17:00:09 +00:00
|
|
|
|
|
2003-11-04 12:01:15 +00:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2004-03-25 09:16:36 +00:00
|
|
|
|
} // namespace anon
|
|
|
|
|
|
|
|
|
|
|
2006-12-10 11:52:46 +00:00
|
|
|
|
docstring const find2string(docstring const & search,
|
2004-03-25 09:16:36 +00:00
|
|
|
|
bool casesensitive, bool matchword, bool forward)
|
|
|
|
|
{
|
2006-12-10 11:52:46 +00:00
|
|
|
|
odocstringstream ss;
|
2004-03-25 09:16:36 +00:00
|
|
|
|
ss << search << '\n'
|
|
|
|
|
<< int(casesensitive) << ' '
|
|
|
|
|
<< int(matchword) << ' '
|
|
|
|
|
<< int(forward);
|
|
|
|
|
return ss.str();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-12-10 11:52:46 +00:00
|
|
|
|
docstring const replace2string(docstring const & search, docstring const & replace,
|
2004-03-25 09:16:36 +00:00
|
|
|
|
bool casesensitive, bool matchword,
|
|
|
|
|
bool all, bool forward)
|
|
|
|
|
{
|
2006-12-10 11:52:46 +00:00
|
|
|
|
odocstringstream ss;
|
2004-03-25 09:16:36 +00:00
|
|
|
|
ss << search << '\n'
|
|
|
|
|
<< replace << '\n'
|
|
|
|
|
<< int(casesensitive) << ' '
|
|
|
|
|
<< int(matchword) << ' '
|
|
|
|
|
<< int(all) << ' '
|
|
|
|
|
<< int(forward);
|
|
|
|
|
return ss.str();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-02-10 18:52:32 +00:00
|
|
|
|
bool find(BufferView * bv, FuncRequest const & ev)
|
2004-03-25 09:16:36 +00:00
|
|
|
|
{
|
|
|
|
|
if (!bv || ev.action != LFUN_WORD_FIND)
|
2008-02-10 18:52:32 +00:00
|
|
|
|
return false;
|
2004-03-25 09:16:36 +00:00
|
|
|
|
|
2007-12-12 19:28:07 +00:00
|
|
|
|
//lyxerr << "find called, cmd: " << ev << endl;
|
2004-03-25 09:16:36 +00:00
|
|
|
|
|
|
|
|
|
// data is of the form
|
|
|
|
|
// "<search>
|
|
|
|
|
// <casesensitive> <matchword> <forward>"
|
2006-12-10 11:52:46 +00:00
|
|
|
|
docstring search;
|
|
|
|
|
docstring howto = split(ev.argument(), search, '\n');
|
2004-03-25 09:16:36 +00:00
|
|
|
|
|
|
|
|
|
bool casesensitive = parse_bool(howto);
|
|
|
|
|
bool matchword = parse_bool(howto);
|
|
|
|
|
bool forward = parse_bool(howto);
|
|
|
|
|
|
2008-02-10 18:52:32 +00:00
|
|
|
|
return find(bv, search, casesensitive, matchword, forward);
|
2004-03-25 09:16:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-06-19 21:48:04 +00:00
|
|
|
|
void replace(BufferView * bv, FuncRequest const & ev, bool has_deleted)
|
2004-03-25 09:16:36 +00:00
|
|
|
|
{
|
|
|
|
|
if (!bv || ev.action != LFUN_WORD_REPLACE)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// data is of the form
|
|
|
|
|
// "<search>
|
|
|
|
|
// <replace>
|
|
|
|
|
// <casesensitive> <matchword> <all> <forward>"
|
2006-12-10 11:52:46 +00:00
|
|
|
|
docstring search;
|
|
|
|
|
docstring rplc;
|
|
|
|
|
docstring howto = split(ev.argument(), search, '\n');
|
2006-10-21 00:16:43 +00:00
|
|
|
|
howto = split(howto, rplc, '\n');
|
2004-03-25 09:16:36 +00:00
|
|
|
|
|
|
|
|
|
bool casesensitive = parse_bool(howto);
|
|
|
|
|
bool matchword = parse_bool(howto);
|
|
|
|
|
bool all = parse_bool(howto);
|
|
|
|
|
bool forward = parse_bool(howto);
|
|
|
|
|
|
2007-06-19 21:48:04 +00:00
|
|
|
|
if (!has_deleted) {
|
|
|
|
|
int const replace_count = all
|
|
|
|
|
? replaceAll(bv, search, rplc, casesensitive, matchword)
|
|
|
|
|
: replace(bv, search, rplc, casesensitive, matchword, forward);
|
|
|
|
|
|
2007-08-21 13:03:55 +00:00
|
|
|
|
Buffer & buf = bv->buffer();
|
2007-06-19 21:48:04 +00:00
|
|
|
|
if (replace_count == 0) {
|
2006-08-23 21:14:43 +00:00
|
|
|
|
// emit message signal.
|
2007-08-21 13:03:55 +00:00
|
|
|
|
buf.message(_("String not found!"));
|
2004-03-25 09:16:36 +00:00
|
|
|
|
} else {
|
2007-06-19 21:48:04 +00:00
|
|
|
|
if (replace_count == 1) {
|
|
|
|
|
// emit message signal.
|
2007-08-21 13:03:55 +00:00
|
|
|
|
buf.message(_("String has been replaced."));
|
2007-06-19 21:48:04 +00:00
|
|
|
|
} else {
|
|
|
|
|
docstring str = convert<docstring>(replace_count);
|
|
|
|
|
str += _(" strings have been replaced.");
|
|
|
|
|
// emit message signal.
|
2007-08-21 13:03:55 +00:00
|
|
|
|
buf.message(str);
|
2007-06-19 21:48:04 +00:00
|
|
|
|
}
|
2004-03-25 09:16:36 +00:00
|
|
|
|
}
|
2007-06-19 21:48:04 +00:00
|
|
|
|
} else {
|
|
|
|
|
// if we have deleted characters, we do not replace at all, but
|
|
|
|
|
// rather search for the next occurence
|
2008-02-10 19:05:09 +00:00
|
|
|
|
if (find(bv, search, casesensitive, matchword, forward))
|
|
|
|
|
bv->showCursor();
|
|
|
|
|
else
|
2007-06-19 21:48:04 +00:00
|
|
|
|
bv->message(_("String not found!"));
|
2004-03-25 09:16:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool findNextChange(BufferView * bv)
|
|
|
|
|
{
|
2005-09-07 10:00:19 +00:00
|
|
|
|
DocIterator cur = bv->cursor();
|
2004-03-25 09:16:36 +00:00
|
|
|
|
|
|
|
|
|
if (!findChange(cur))
|
|
|
|
|
return false;
|
|
|
|
|
|
2006-03-11 13:31:41 +00:00
|
|
|
|
bv->cursor().setCursor(cur);
|
|
|
|
|
bv->cursor().resetAnchor();
|
2006-04-05 23:56:29 +00:00
|
|
|
|
|
2006-05-05 23:11:19 +00:00
|
|
|
|
Change orig_change = cur.paragraph().lookupChange(cur.pos());
|
2004-03-25 09:16:36 +00:00
|
|
|
|
|
2007-08-13 13:36:19 +00:00
|
|
|
|
CursorSlice & tip = cur.top();
|
|
|
|
|
for (; !tip.at_end(); tip.forwardPos()) {
|
|
|
|
|
Change change = tip.paragraph().lookupChange(tip.pos());
|
|
|
|
|
if (change != orig_change)
|
2006-03-11 13:31:41 +00:00
|
|
|
|
break;
|
2004-03-25 09:16:36 +00:00
|
|
|
|
}
|
2007-02-01 17:26:29 +00:00
|
|
|
|
// avoid crash (assertion violation) if the imaginary end-of-par
|
2007-05-28 22:27:45 +00:00
|
|
|
|
// character of the last paragraph of the document is marked as changed
|
2007-08-13 13:36:19 +00:00
|
|
|
|
if (tip.at_end())
|
|
|
|
|
tip.backwardPos();
|
2007-02-01 17:26:29 +00:00
|
|
|
|
|
2006-03-11 13:31:41 +00:00
|
|
|
|
// Now put cursor to end of selection:
|
|
|
|
|
bv->cursor().setCursor(cur);
|
|
|
|
|
bv->cursor().setSelection();
|
2004-09-17 16:28:47 +00:00
|
|
|
|
|
2004-03-25 09:16:36 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // lyx namespace
|