mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
Implement a dociterator::forwardPos() variant that skips collapsed insets and use that in bruteFind() (fixes bug 2241 and bug 2094)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10782 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0b281dcea7
commit
02127298e7
@ -1,3 +1,16 @@
|
|||||||
|
2006-01-28 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||||
|
|
||||||
|
* bufferview_funcs.C (coordOffset): remove the check for
|
||||||
|
collapsed collapsables (fix for bug 2094). This is now done
|
||||||
|
on a more general level (cursor.C).
|
||||||
|
|
||||||
|
* dociterator.[Ch] (forwardPos): add an optional argument
|
||||||
|
bool "ignorecollapsed" (default false), which lets forwardPos
|
||||||
|
skip collapsed insets.
|
||||||
|
|
||||||
|
* cursor.C (bruteFind): use forwardPos(ignorecollapsed = true)
|
||||||
|
(fixes bug 2241 and 2094).
|
||||||
|
|
||||||
2006-01-26 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
2006-01-26 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||||
|
|
||||||
* buffer.C: change tracking (dvipost) doesn't require
|
* buffer.C: change tracking (dvipost) doesn't require
|
||||||
|
@ -163,10 +163,6 @@ Point coordOffset(DocIterator const & dit, bool boundary)
|
|||||||
CursorSlice const & sl = dit[i];
|
CursorSlice const & sl = dit[i];
|
||||||
int xx = 0;
|
int xx = 0;
|
||||||
int yy = 0;
|
int yy = 0;
|
||||||
//FIXME: the check for asMathInset() shouldn't be necessary
|
|
||||||
// but math insets do not return a sensible editable() state yet.
|
|
||||||
if (sl.inset().asMathInset()
|
|
||||||
|| sl.inset().editable() == InsetBase::HIGHLY_EDITABLE)
|
|
||||||
sl.inset().cursorPos(sl, boundary && ((i+1) == dit.depth()), xx, yy);
|
sl.inset().cursorPos(sl, boundary && ((i+1) == dit.depth()), xx, yy);
|
||||||
x += xx;
|
x += xx;
|
||||||
y += yy;
|
y += yy;
|
||||||
|
@ -128,7 +128,7 @@ namespace {
|
|||||||
double best_dist = std::numeric_limits<double>::max();;
|
double best_dist = std::numeric_limits<double>::max();;
|
||||||
DocIterator best_cursor = et;
|
DocIterator best_cursor = et;
|
||||||
|
|
||||||
for ( ; it != et; it.forwardPos()) {
|
for ( ; it != et; it.forwardPos(true)) {
|
||||||
// avoid invalid nesting when selecting
|
// avoid invalid nesting when selecting
|
||||||
if (bv_funcs::status(&cursor.bv(), it) == bv_funcs::CUR_INSIDE
|
if (bv_funcs::status(&cursor.bv(), it) == bv_funcs::CUR_INSIDE
|
||||||
&& (!cursor.selection() || positionable(it, cursor.anchor_))) {
|
&& (!cursor.selection() || positionable(it, cursor.anchor_))) {
|
||||||
|
@ -289,7 +289,7 @@ InsetBase * DocIterator::innerInsetOfType(int code) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DocIterator::forwardPos()
|
void DocIterator::forwardPos(bool ignorecollapsed)
|
||||||
{
|
{
|
||||||
//this dog bites his tail
|
//this dog bites his tail
|
||||||
if (empty()) {
|
if (empty()) {
|
||||||
@ -297,6 +297,15 @@ void DocIterator::forwardPos()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// jump over collapsables if they are collapsed
|
||||||
|
// FIXME: the check for asMathInset() shouldn't be necessary
|
||||||
|
// but math insets do not return a sensible editable() state yet.
|
||||||
|
if (ignorecollapsed && nextInset() && (!nextInset()->asMathInset()
|
||||||
|
&& nextInset()->editable() != InsetBase::HIGHLY_EDITABLE)) {
|
||||||
|
++top().pos();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CursorSlice & tip = top();
|
CursorSlice & tip = top();
|
||||||
//lyxerr << "XXX\n" << *this << endl;
|
//lyxerr << "XXX\n" << *this << endl;
|
||||||
|
|
||||||
|
@ -178,8 +178,11 @@ public:
|
|||||||
//
|
//
|
||||||
/// move on one logical position, do not descend into nested insets
|
/// move on one logical position, do not descend into nested insets
|
||||||
void forwardPosNoDescend();
|
void forwardPosNoDescend();
|
||||||
/// move on one logical position, descend into nested insets
|
/**
|
||||||
void forwardPos();
|
* move on one logical position, descend into nested insets
|
||||||
|
* skip collapsed insets if \p ignorecollapsed is true
|
||||||
|
*/
|
||||||
|
void forwardPos(bool ignorecollapsed = false);
|
||||||
/// move on one physical character or inset
|
/// move on one physical character or inset
|
||||||
void forwardChar();
|
void forwardChar();
|
||||||
/// move on one paragraph
|
/// move on one paragraph
|
||||||
|
Loading…
Reference in New Issue
Block a user