]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.cpp
Fulfill promise to Andre: TextClass_ptr --> TextClassPtr.
[lyx.git] / src / Cursor.cpp
index 363114ef5a0afe5e1b9c1cc055da79e812307be0..60598573d6432c6f4cebbbb1914f311a180b6a42 100644 (file)
@@ -132,6 +132,7 @@ namespace {
        }
 
 
+       /*
        /// moves position closest to (x, y) in given box
        bool bruteFind(Cursor & cursor,
                int x, int y, int xlow, int xhigh, int ylow, int yhigh)
@@ -186,6 +187,7 @@ namespace {
 
                return false;
        }
+       */
 
 
        /// moves position closest to (x, y) in given box
@@ -680,10 +682,10 @@ 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());
+       //bruteFind(*this, x, y, 0, bv().workWidth(), 0, bv().workHeight());
 }
 
 
@@ -1461,8 +1463,8 @@ Font Cursor::getFont() const
        if (pos > 0) {
                TextMetrics const & tm = bv().textMetrics(&text);
                if (pos == sl.lastpos()
-                               || (par.isSeparator(pos) &&
-                                               !tm.isRTLBoundary(par, pos)))
+                       || (par.isSeparator(pos) 
+                       && !tm.isRTLBoundary(sl.pit(), pos)))
                        --pos;
        }
        
@@ -1507,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
@@ -1526,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(par, cpos))
+                       if (!tm.isRTLBoundary(cpit, cpos))
                                --cpos;
                }
        }
@@ -1534,11 +1538,11 @@ void Cursor::setCurrentFont()
        // get font
        BufferParams const & bufparams = buffer().params();
        current_font = par.getFontSettings(bufparams, cpos);
-       real_current_font = tm.getDisplayFont(par, cpos);
+       real_current_font = tm.getDisplayFont(cpit, cpos);
 
        // special case for paragraph end
-       if (pos() == lastpos()
-           && tm.isRTLBoundary(par, pos())
+       if (cs.pos() == lastpos()
+           && tm.isRTLBoundary(cpit, cs.pos())
            && !boundary()) {
                Language const * lang = par.getParLanguage(bufparams);
                current_font.setLanguage(lang);