]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.cpp
Fulfill promise to Andre: TextClass_ptr --> TextClassPtr.
[lyx.git] / src / Cursor.cpp
index 95c0d71999f1ba0bd844ce2737d1c74199c872fd..60598573d6432c6f4cebbbb1914f311a180b6a42 100644 (file)
@@ -682,7 +682,7 @@ bool Cursor::openable(MathAtom const & t) const
 }
 
 
-void Cursor::setScreenPos(int x, int y)
+void Cursor::setScreenPos(int x, int /*y*/)
 {
        setTargetX(x);
        //bruteFind(*this, x, y, 0, bv().workWidth(), 0, bv().workHeight());
@@ -1509,9 +1509,11 @@ bool notifyCursorLeaves(DocIterator const & old, Cursor & cur)
 
 void Cursor::setCurrentFont()
 {
-       pos_type cpos = pos();
-       Paragraph & par = paragraph();
-       Text const & ctext = *text();
+       CursorSlice const & cs = innerTextSlice();
+       Paragraph const & par = cs.paragraph();
+       pos_type cpit = cs.pit();
+       pos_type cpos = cs.pos();
+       Text const & ctext = *cs.text();
        TextMetrics const & tm = bv().textMetrics(&ctext);
 
        // are we behind previous char in fact? -> go to that char
@@ -1528,7 +1530,7 @@ void Cursor::setCurrentFont()
                        // abc| def -> font of c
                        // abc |[WERBEH], i.e. boundary==true -> font of c
                        // abc [WERBEH]| def, font of the space
-                       if (!tm.isRTLBoundary(pit(), cpos))
+                       if (!tm.isRTLBoundary(cpit, cpos))
                                --cpos;
                }
        }
@@ -1536,11 +1538,11 @@ void Cursor::setCurrentFont()
        // get font
        BufferParams const & bufparams = buffer().params();
        current_font = par.getFontSettings(bufparams, cpos);
-       real_current_font = tm.getDisplayFont(pit(), cpos);
+       real_current_font = tm.getDisplayFont(cpit, cpos);
 
        // special case for paragraph end
-       if (pos() == lastpos()
-           && tm.isRTLBoundary(pit(), pos())
+       if (cs.pos() == lastpos()
+           && tm.isRTLBoundary(cpit, cs.pos())
            && !boundary()) {
                Language const * lang = par.getParLanguage(bufparams);
                current_font.setLanguage(lang);