From 1cbeb0b244fd631344ce167f4209b8454c5d41ee Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 7 Feb 2008 17:07:27 +0000 Subject: [PATCH] code simplification by using DocIterator::innerTextSlice(). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22847 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Cursor.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 2b301257f6..38ec3e4ebe 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -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());