]> git.lyx.org Git - lyx.git/blobdiff - src/rowpainter.cpp
The two lines deleted here attempt to call virtual functions from a constructor....
[lyx.git] / src / rowpainter.cpp
index d36916126fddcfe38521a9b2282051e5d8c834fc..3b7bbe09db2c5b427cbd87ae7b2a4f62873fb71a 100644 (file)
@@ -109,6 +109,7 @@ void RowPainter::paintInset(Inset const * inset, pos_type const pos)
        pi_.erased_ = erased_ || par_.isDeleted(pos);
        pi_.base.bv->coordCache().insets().add(inset, int(x_), yo_);
        // insets are painted completely. Recursive
+       inset->drawBackground(pi_, int(x_), yo_);
        inset->drawSelection(pi_, int(x_), yo_);
        inset->draw(pi_, int(x_), yo_);
 
@@ -246,6 +247,7 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font,
        // selected text?
        bool const selection = pos >= row_.sel_beg && pos < row_.sel_end;
 
+       char_type prev_char = ' ';
        // collect as much similar chars as we can
        for (++vpos ; vpos < end ; ++vpos) {
                pos = bidi_.vis2log(vpos);
@@ -264,6 +266,11 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font,
 
                char_type c = par_.getChar(pos);
 
+               if (c == '\t' || prev_char == '\t') {
+                       prev_char = c;
+                       break;
+               }
+
                if (!isPrintableNonspace(c))
                        break;
 
@@ -308,6 +315,9 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font,
 
        docstring s(&str[0], str.size());
 
+       if (s[0] == '\t')
+               s.replace(0,1,from_ascii("    "));
+
        if (!selection && !change_running.changed()) {
                x_ += pi_.pain.text(int(x_), yo_, s, font);
                return;
@@ -674,7 +684,14 @@ void RowPainter::paintOnlyInsets()
                if (x_ > pi_.base.bv->workWidth())
                        continue;
                x_ = pi_.base.bv->coordCache().getInsets().x(inset);
+
+               bool const pi_selected = pi_.selected;
+               Cursor const & cur = pi_.base.bv->cursor();
+               if (cur.selection() && cur.text() == &text_ 
+                         && cur.anchor().text() == &text_)
+                       pi_.selected = row_.sel_beg <= pos && row_.sel_end > pos; 
                paintInset(inset, pos);
+               pi_.selected = pi_selected;
        }
 }
 
@@ -809,7 +826,14 @@ void RowPainter::paintText()
                } else if (inset) {
                        // If outer row has changed, nested insets are repaint completely.
                        pi_.base.bv->coordCache().insets().add(inset, int(x_), yo_);
+                       
+                       bool const pi_selected = pi_.selected;
+                       Cursor const & cur = pi_.base.bv->cursor();
+                       if (cur.selection() && cur.text() == &text_ 
+                                 && cur.anchor().text() == &text_)
+                               pi_.selected = row_.sel_beg <= pos && row_.sel_end > pos; 
                        paintInset(inset, pos);
+                       pi_.selected = pi_selected;
                        ++vpos;
 
                } else {