mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
* first step to proper RTL support of the completion. The cursor is still wrong.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23130 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
aa532e094f
commit
7b0ea48d31
@ -765,6 +765,10 @@ void RowPainter::paintText()
|
||||
|
||||
x_ += row_.label_hfill + lwidth - width_pos;
|
||||
}
|
||||
|
||||
// Is the inline completion in front of character?
|
||||
if (font.isRightToLeft() && vpos == inlineCompletionVPos_)
|
||||
paintInlineCompletion(vpos, font);
|
||||
|
||||
if (par_.isSeparator(pos)) {
|
||||
Font const orig_font = text_metrics_.getDisplayFont(pit_, pos);
|
||||
@ -786,31 +790,9 @@ void RowPainter::paintText()
|
||||
paintFromPos(vpos);
|
||||
}
|
||||
|
||||
// Is the inline completion here?
|
||||
// FIXME: RTL support needed here
|
||||
if (vpos - 1 == inlineCompletionVPos_) {
|
||||
docstring const & completion = pi_.base.bv->inlineCompletion();
|
||||
FontInfo f = font.fontInfo();
|
||||
|
||||
// draw the unique and the non-unique completion part
|
||||
// Note: this is not time-critical as it is
|
||||
// only done once per screen.
|
||||
size_t uniqueTo = pi_.base.bv->inlineCompletionUniqueChars();
|
||||
docstring s1 = completion.substr(0, uniqueTo);
|
||||
docstring s2 = completion.substr(uniqueTo);
|
||||
|
||||
if (s1.size() > 0) {
|
||||
f.setColor(Color_inlinecompletion);
|
||||
pi_.pain.text(x_, yo_, s1, f);
|
||||
x_ += theFontMetrics(font).width(s1);
|
||||
}
|
||||
|
||||
if (s2.size() > 0) {
|
||||
f.setColor(Color_nonunique_inlinecompletion);
|
||||
pi_.pain.text(x_, yo_, s2, f);
|
||||
x_ += theFontMetrics(font).width(s2);
|
||||
}
|
||||
}
|
||||
// Is the inline completion after character?
|
||||
if (!font.isRightToLeft() && vpos - 1 == inlineCompletionVPos_)
|
||||
paintInlineCompletion(vpos, font);
|
||||
}
|
||||
|
||||
// if we reach the end of a struck out range, paint it
|
||||
@ -825,4 +807,34 @@ void RowPainter::paintText()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RowPainter::paintInlineCompletion(pos_type & vpos, Font const & font)
|
||||
{
|
||||
docstring completion = pi_.base.bv->inlineCompletion();
|
||||
FontInfo f = font.fontInfo();
|
||||
|
||||
// right to left?
|
||||
if (font.isRightToLeft())
|
||||
reverse(completion.begin(), completion.end());
|
||||
|
||||
// draw the unique and the non-unique completion part
|
||||
// Note: this is not time-critical as it is
|
||||
// only done once per screen.
|
||||
size_t uniqueTo = pi_.base.bv->inlineCompletionUniqueChars();
|
||||
docstring s1 = completion.substr(0, uniqueTo);
|
||||
docstring s2 = completion.substr(uniqueTo);
|
||||
|
||||
if (s1.size() > 0) {
|
||||
f.setColor(Color_inlinecompletion);
|
||||
pi_.pain.text(x_, yo_, s1, f);
|
||||
x_ += theFontMetrics(font).width(s1);
|
||||
}
|
||||
|
||||
if (s2.size() > 0) {
|
||||
f.setColor(Color_nonunique_inlinecompletion);
|
||||
pi_.pain.text(x_, yo_, s2, f);
|
||||
x_ += theFontMetrics(font).width(s2);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -63,7 +63,8 @@ private:
|
||||
int paintAppendixStart(int y);
|
||||
void paintFromPos(pos_type & vpos);
|
||||
void paintInset(Inset const * inset, pos_type const pos);
|
||||
|
||||
void paintInlineCompletion(pos_type & vpos, Font const & font);
|
||||
|
||||
/// return left margin
|
||||
int leftMargin() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user