]> git.lyx.org Git - lyx.git/blobdiff - src/TextMetrics.cpp
Fix the rest of bug 5010.
[lyx.git] / src / TextMetrics.cpp
index c1965cb5ee4d41ff3ffd7f37ddbbd2475be56a53..94b29f683e1511f90c59dce2d92ec120d668ed4e 100644 (file)
@@ -49,7 +49,7 @@
 
 #include "support/debug.h"
 #include <cstdlib>
-#include "support/assert.h"
+#include "support/lassert.h"
 
 using namespace std;
 
@@ -1905,7 +1905,7 @@ int TextMetrics::leftMargin(int max_width,
            && !(!par.empty()
                    && par.isInset(pos)
                    && par.getInset(pos)->display())
-                       && ((tclass.isDefaultLayout(par.layout())
+                       && (!(tclass.isDefaultLayout(par.layout())
                 || tclass.isEmptyLayout(par.layout()))
                || buffer.params().paragraph_separation == BufferParams::ParagraphIndentSeparation)
            )
@@ -2033,6 +2033,10 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type pit, int x, int y) co
                        beg.pos() = row.sel_beg;
                        end.pit() = pit;
                        end.pos() = row.sel_end;
+                       if (end.pos() == row.endpos()) {
+                               // selection goes till the end of the row.
+                               end.boundary(true);
+                       }
                        drawRowSelection(pi, x, row, beg, end, beg_margin, end_margin);
                }