code simplification by using DocIterator::innerTextSlice().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22847 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-02-07 17:07:27 +00:00
parent 03fb3b0aec
commit 1cbeb0b244

View File

@ -1413,13 +1413,7 @@ Encoding const * Cursor::getEncoding() const
{
if (empty())
return 0;
int s = 0;
// go up until first non-0 text is hit
// (innermost text is 0 in mathed)
for (s = depth() - 1; s >= 0; --s)
if (operator[](s).text())
break;
CursorSlice const & sl = operator[](s);
CursorSlice const & sl = innerTextSlice();
Text const & text = *sl.text();
Font font = text.getPar(sl.pit()).getFont(
bv().buffer().params(), sl.pos(), outerFont(sl.pit(), text.paragraphs()));
@ -1458,13 +1452,8 @@ Font Cursor::getFont() const
// if a character is entered.
// HACK. far from being perfect...
// go up until first non-0 text is hit
// (innermost text is 0 in mathed)
int s = 0;
for (s = depth() - 1; s >= 0; --s)
if (operator[](s).text())
break;
CursorSlice const & sl = operator[](s);
CursorSlice const & sl = innerTextSlice();
Text const & text = *sl.text();
Paragraph const & par = text.getPar(sl.pit());