]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
hopefully fix tex2lyx linking.
[lyx.git] / src / text2.C
index b5883f3ba676609d77f95ffb282114e54ea15d69..0513d5181c24454afdcd574ff0d8553f070b2c41 100644 (file)
@@ -352,7 +352,7 @@ void LyXText::setLayout(Buffer const & buffer, pit_type start, pit_type end,
        for (pit_type pit = start; pit != end; ++pit) {
                pars_[pit].applyLayout(lyxlayout);
                if (lyxlayout->margintype == MARGIN_MANUAL)
-                       pars_[pit].setLabelWidthString(lyxlayout->labelstring());
+                       pars_[pit].setLabelWidthString(buffer.translateLabel(lyxlayout->labelstring()));
        }
 }
 
@@ -576,7 +576,7 @@ void LyXText::toggleFree(LCursor & cur, LyXFont const & font, bool toggleall)
 }
 
 
-string LyXText::getStringToIndex(LCursor const & cur)
+docstring LyXText::getStringToIndex(LCursor const & cur)
 {
        BOOST_ASSERT(this == cur.text());
 
@@ -598,13 +598,13 @@ string LyXText::getStringToIndex(LCursor const & cur)
                        idxstring = tmpcur.selectionAsString(false);
        }
 
-       return to_utf8(idxstring);
+       return idxstring;
 }
 
 
 void LyXText::setParagraph(LCursor & cur,
                           Spacing const & spacing, LyXAlignment align,
-                          string const & labelwidthstring, bool noindent)
+                          docstring const & labelwidthstring, bool noindent)
 {
        BOOST_ASSERT(cur.text());
        // make sure that the depth behind the selection are restored, too
@@ -628,8 +628,7 @@ void LyXText::setParagraph(LCursor & cur,
                        else
                                params.align(align);
                }
-               // FIXME UNICODE
-               par.setLabelWidthString(from_ascii(labelwidthstring));
+               par.setLabelWidthString(labelwidthstring);
                params.noindent(noindent);
        }
 }
@@ -970,7 +969,8 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
        bool bound = false;
 
        int xx = x; // is modified by getColumnNearX
-       pos_type const pos = row.pos() + getColumnNearX(cur.bv(), pit, row, xx, bound);
+       pos_type const pos = row.pos()
+               + getColumnNearX(cur.bv(), pit, row, xx, bound);
        cur.pit() = pit;
        cur.pos() = pos;
        cur.boundary(bound);
@@ -986,18 +986,22 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
                return 0;
        }
 
+       InsetBase * insetBefore = pos? pars_[pit].getInset(pos - 1): 0;
+       //InsetBase * insetBehind = pars_[pit].getInset(pos);
+
        // This should be just before or just behind the
        // cursor position set above.
-        InsetBase * inset2 = pars_[pit].getInset(pos - 1);
-        InsetBase * inset3 = pars_[pit].getInset(pos);
-        
-       BOOST_ASSERT((pos != 0 && inset == inset2)
-                    || inset == inset3);
+       BOOST_ASSERT((pos != 0 && inset == insetBefore)
+               || inset == pars_[pit].getInset(pos));
+
        // Make sure the cursor points to the position before
        // this inset.
-       if (inset == pars_[pit].getInset(pos - 1))
+       if (inset == insetBefore)
                --cur.pos();
+
+       // Try to descend recursively inside the inset.
        inset = inset->editXY(cur, x, y);
+
        if (cur.top().text() == this)
                setCurrentFont(cur);
        return inset;