mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
* Cursor::isRTL(): correctly deal with the inner paragraph when within mathed.
* DocIterator::innerParagraph(): new method giving the inner paragraph. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18114 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
03951b16e6
commit
7b06307cc6
@ -1329,6 +1329,9 @@ void Cursor::fixIfBroken()
|
|||||||
|
|
||||||
bool Cursor::isRTL() const
|
bool Cursor::isRTL() const
|
||||||
{
|
{
|
||||||
|
if (inMathed())
|
||||||
|
return innerParagraph().isRightToLeftPar(bv().buffer()->params());
|
||||||
|
|
||||||
return top().paragraph().isRightToLeftPar(bv().buffer()->params());
|
return top().paragraph().isRightToLeftPar(bv().buffer()->params());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,6 +181,22 @@ Paragraph const & DocIterator::paragraph() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Paragraph const & DocIterator::innerParagraph() const
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(!empty());
|
||||||
|
// go up until first non-0 text is hit
|
||||||
|
// (innermost text is 0 in mathed)
|
||||||
|
for (int i = depth() - 1; i >= 0; --i)
|
||||||
|
if (slices_[i].text())
|
||||||
|
return slices_[i].paragraph();
|
||||||
|
|
||||||
|
// This case is in principe not possible. We _must_
|
||||||
|
// we inside a Paragraph.
|
||||||
|
BOOST_ASSERT(false);
|
||||||
|
return paragraph();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
pit_type DocIterator::lastpit() const
|
pit_type DocIterator::lastpit() const
|
||||||
{
|
{
|
||||||
return inMathed() ? 0 : text()->paragraphs().size() - 1;
|
return inMathed() ? 0 : text()->paragraphs().size() - 1;
|
||||||
|
@ -155,8 +155,13 @@ public:
|
|||||||
//
|
//
|
||||||
/// the paragraph we're in
|
/// the paragraph we're in
|
||||||
Paragraph & paragraph();
|
Paragraph & paragraph();
|
||||||
/// the paragraph we're in
|
/// the paragraph we're in in text mode.
|
||||||
|
/// \warning only works within text!
|
||||||
Paragraph const & paragraph() const;
|
Paragraph const & paragraph() const;
|
||||||
|
/// the paragraph we're in in any case.
|
||||||
|
/// This method will give the containing paragraph if
|
||||||
|
/// in not in text mode (ex: in mathed).
|
||||||
|
Paragraph const & innerParagraph() const;
|
||||||
///
|
///
|
||||||
Text * text();
|
Text * text();
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user