]> git.lyx.org Git - lyx.git/blobdiff - src/text.C
More fixes to insettabular/text (and some missing features added).
[lyx.git] / src / text.C
index 0cc4832eb58aeb5974464bedeaae32981162e5c2..be6bb3b6a327410124bc246034bbc5a53e213455 100644 (file)
@@ -344,18 +344,18 @@ void LyXText::ComputeBidiTables(Buffer const * buf, Row * row) const
 bool LyXText::IsBoundary(Buffer const * buf, LyXParagraph * par,
                         LyXParagraph::size_type pos) const
 {
-       if (!lyxrc.rtl_support)
-               return false;    // This is just for speedup
+       if (!lyxrc.rtl_support || pos == 0)
+               return false;
 
-       if (!bidi_InRange(pos - 1))
+       if (!bidi_InRange(pos - 1)) {
+               lyxerr << "LyXText::IsBoundary This shouldn't happen." << endl;
                return false;
+       }
 
        bool const rtl = bidi_level(pos - 1) % 2;
-       bool rtl2 = rtl;
-       if (pos == par->Last())
-               rtl2 = par->isRightToLeftPar(buf->params);
-       else if (bidi_InRange(pos))
-               rtl2 = bidi_level(pos) % 2;
+       bool rtl2 = bidi_InRange(pos)
+               ? bidi_level(pos) % 2
+               : par->isRightToLeftPar(buf->params);
        return rtl != rtl2;
 }
 
@@ -368,11 +368,9 @@ bool LyXText::IsBoundary(Buffer const * buf, LyXParagraph * par,
                return false;    // This is just for speedup
 
        bool const rtl = font.isVisibleRightToLeft();
-       bool rtl2 = rtl;
-       if (pos == par->Last())
-               rtl2 = par->isRightToLeftPar(buf->params);
-       else if (bidi_InRange(pos))
-               rtl2 =  bidi_level(pos) % 2;
+       bool rtl2 = bidi_InRange(pos)
+               ? bidi_level(pos) % 2
+               : par->isRightToLeftPar(buf->params);
        return rtl != rtl2;
 }
 
@@ -506,10 +504,12 @@ void LyXText::draw(BufferView * bview, Row const * row,
 //                     tmpinset->update(bview, font, false);
                        tmpinset->draw(bview, font, offset+row->baseline(), x,
                                       cleared);
+#ifdef SEEMS_TO_BE_NOT_NEEDED
                        if (status == CHANGED_IN_DRAW) {
                                UpdateInset(bview, tmpinset);
                                status = CHANGED_IN_DRAW;
                        }
+#endif
                }
                ++vpos;
 
@@ -1913,7 +1913,7 @@ void LyXText::InsertChar(BufferView * bview, char c)
        if (lyxrc.auto_number) {
                if (current_font.number() == LyXFont::ON) {
                        if (!isdigit(c) && !strchr("+-/*", c) &&
-                           !(strchr(".",c) &&
+                           !(strchr(".,",c) &&
                              cursor.pos() >= 1 &&
                              cursor.pos() < cursor.par()->size() &&
                              GetFont(bview->buffer(),
@@ -1939,7 +1939,7 @@ void LyXText::InsertChar(BufferView * bview, char c)
                                                    cursor.par(),
                                                    cursor.pos() - 1,
                                                    current_font);
-                               } else if (strchr(".", c) &&
+                               } else if (strchr(".,", c) &&
                                           cursor.pos() >= 2 &&
                                           GetFont(bview->buffer(),
                                                   cursor.par(),
@@ -2113,6 +2113,10 @@ void LyXText::InsertChar(BufferView * bview, char c)
 
                SetCursor(bview, cursor.par(), cursor.pos() + 1, false,
                          cursor.boundary());
+               if (IsBoundary(bview->buffer(), cursor.par(), cursor.pos())
+                   != cursor.boundary())
+                       SetCursor(bview, cursor.par(), cursor.pos(), false,
+                         !cursor.boundary());
                if (row->next() && row->next()->par() == row->par())
                        need_break_row = row->next();
                else
@@ -3000,14 +3004,16 @@ void LyXText::Backspace(BufferView * bview)
        // current_font = rawtmpfont;
        // real_current_font = realtmpfont;
 
+       if (IsBoundary(bview->buffer(), cursor.par(), cursor.pos())
+           != cursor.boundary())
+               SetCursor(bview, cursor.par(), cursor.pos(), false,
+                         !cursor.boundary());
+
        lastpos = cursor.par()->Last();
-       if (cursor.pos() == lastpos) {
-               if (IsBoundary(bview->buffer(), cursor.par(), cursor.pos()) != cursor.boundary())
-                       SetCursor(bview, cursor.par(), cursor.pos(), false, !cursor.boundary());
+       if (cursor.pos() == lastpos)
                SetCurrentFont(bview);
-       }
        
-       // check, wether the last characters font has changed.
+       // check, whether the last characters font has changed.
        if (rawparfont != 
            cursor.par()->GetFontSettings(bview->buffer()->params, lastpos - 1)) {
                RedoHeightOfParagraph(bview, cursor);
@@ -3387,7 +3393,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
 
                for (int i = 1; i <= depth; ++i) {
                        int const line_x = (LYX_PAPER_MARGIN / 5) *
-                               (i + minipage) + box_x;
+                               (i + minipage) + box_x + x_offset;
                        pain.line(line_x, y_offset, line_x,
                                  y_offset + row_ptr->height() - 1 - (i - next_depth - 1) * 3,
                                  LColor::depthbar);