]> git.lyx.org Git - features.git/commitdiff
code simplification by using DocIterator::innerTextSlice().
authorAbdelrazak Younes <younes@lyx.org>
Thu, 7 Feb 2008 17:07:27 +0000 (17:07 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 7 Feb 2008 17:07:27 +0000 (17:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22847 a592a061-630c-0410-9148-cb99ea01b6c8

src/Cursor.cpp

index 2b301257f69a31d0ec30a5902456573458423473..38ec3e4ebe2c1412368513a61f3413a4db13edaf 100644 (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());