mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
don't draw selection too wide (esp visible in full screen mode)
there is still one issue which is related (or so i think) to the pit is not being updated when extending a selection to a new row with cursor right/left. i left a FIXME in the code i put this in since it is a uniform improvement on the current situation... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24089 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7396e75a50
commit
94699b5865
@ -2025,8 +2025,10 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type pit, int x, int y) co
|
||||
if (row_selection) {
|
||||
DocIterator beg = bv_->cursor().selectionBegin();
|
||||
DocIterator end = bv_->cursor().selectionEnd();
|
||||
bool const beg_margin = beg.pit() < pit && i == 0;
|
||||
bool const end_margin = end.pit() > pit && i == nrows - 1;
|
||||
// FIXME (not here): pit is not updated when extending
|
||||
// a selection to a new row with cursor right/left
|
||||
bool const beg_margin = beg.pit() < pit;
|
||||
bool const end_margin = end.pit() > pit;
|
||||
beg.pit() = pit;
|
||||
beg.pos() = row.sel_beg;
|
||||
end.pit() = pit;
|
||||
@ -2082,17 +2084,23 @@ void TextMetrics::drawRowSelection(PainterInfo & pi, int x, Row const & row,
|
||||
|
||||
// draw the margins
|
||||
if (drawOnBegMargin) {
|
||||
if (text_->isRTL(buffer, beg.paragraph()))
|
||||
pi.pain.fillRectangle(x + x1, y1, width() - x1, y2 - y1, Color_selection);
|
||||
else
|
||||
pi.pain.fillRectangle(x, y1, x1, y2 - y1, Color_selection);
|
||||
if (text_->isRTL(buffer, beg.paragraph())) {
|
||||
int lm = bv_->leftMargin();
|
||||
pi.pain.fillRectangle(x + x1, y1, width() - lm - x1, y2 - y1, Color_selection);
|
||||
} else {
|
||||
int rm = bv_->rightMargin();
|
||||
pi.pain.fillRectangle(rm, y1, x1 - rm, y2 - y1, Color_selection);
|
||||
}
|
||||
}
|
||||
|
||||
if (drawOnEndMargin) {
|
||||
if (text_->isRTL(buffer, beg.paragraph()))
|
||||
pi.pain.fillRectangle(x, y1, x2, y2 - y1, Color_selection);
|
||||
else
|
||||
pi.pain.fillRectangle(x + x2, y1, width() - x2, y2 - y1, Color_selection);
|
||||
if (text_->isRTL(buffer, beg.paragraph())) {
|
||||
int rm = bv_->rightMargin();
|
||||
pi.pain.fillRectangle(x + rm, y1, x2 - rm, y2 - y1, Color_selection);
|
||||
} else {
|
||||
int lm = bv_->leftMargin();
|
||||
pi.pain.fillRectangle(x + x2, y1, width() - lm - x2, y2 - y1, Color_selection);
|
||||
}
|
||||
}
|
||||
|
||||
// if we are on a boundary from the beginning, it's probably
|
||||
|
Loading…
Reference in New Issue
Block a user