mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +00:00
Fix bug 3889 (justification of Bidi text in the GUI)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19016 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
19e12e5fab
commit
72535633e3
14
src/Text.cpp
14
src/Text.cpp
@ -1718,6 +1718,12 @@ int Text::cursorX(BufferView const & bv, CursorSlice const & sl,
|
||||
|
||||
pos_type const row_pos = row.pos();
|
||||
pos_type const end = row.endpos();
|
||||
// Spaces at logical line breaks in bidi text must be skipped during
|
||||
// cursor positioning. However, they may appear visually in the middle
|
||||
// of a row; they must be skipped, wherever they are...
|
||||
// * logically "abc_[HEBREW_\nHEBREW]"
|
||||
// * visually "abc_[_WERBEH\nWERBEH]"
|
||||
pos_type skipped_sep_vpos = -1;
|
||||
|
||||
if (end <= row_pos)
|
||||
cursor_vpos = row_pos;
|
||||
@ -1743,7 +1749,15 @@ int Text::cursorX(BufferView const & bv, CursorSlice const & sl,
|
||||
FontMetrics const & labelfm = theFontMetrics(
|
||||
getLabelFont(buffer, par));
|
||||
|
||||
// If the last logical character is a separator, skip it, unless
|
||||
// it's in the last row of a paragraph; see skipped_sep_vpos declaration
|
||||
if (end > 0 && end < par.size() && par.isSeparator(end - 1))
|
||||
skipped_sep_vpos = bidi.log2vis(end - 1);
|
||||
|
||||
for (pos_type vpos = row_pos; vpos < cursor_vpos; ++vpos) {
|
||||
// Skip the separator which is at the logical end of the row
|
||||
if (vpos == skipped_sep_vpos)
|
||||
continue;
|
||||
pos_type pos = bidi.vis2log(vpos);
|
||||
if (body_pos > 0 && pos == body_pos - 1) {
|
||||
// FIXME UNICODE
|
||||
|
@ -734,6 +734,12 @@ void RowPainter::paintLast()
|
||||
void RowPainter::paintText()
|
||||
{
|
||||
pos_type const end = row_.endpos();
|
||||
// Spaces at logical line breaks in bidi text must be skipped during
|
||||
// painting. However, they may appear visually in the middle
|
||||
// of a row; they must be skipped, wherever they are...
|
||||
// * logically "abc_[HEBREW_\nHEBREW]"
|
||||
// * visually "abc_[_WERBEH\nWERBEH]"
|
||||
pos_type skipped_sep_vpos = -1;
|
||||
pos_type body_pos = par_.beginOfBody();
|
||||
if (body_pos > 0 &&
|
||||
(body_pos > end || !par_.isLineSeparator(body_pos - 1))) {
|
||||
@ -751,10 +757,21 @@ void RowPainter::paintText()
|
||||
Font font;
|
||||
Buffer const & buffer = *bv_.buffer();
|
||||
|
||||
// If the last logical character is a separator, don't paint it, unless
|
||||
// it's in the last row of a paragraph; see skipped_sep_vpos declaration
|
||||
if (end > 0 && end < par_.size() && par_.isSeparator(end - 1))
|
||||
skipped_sep_vpos = bidi_.log2vis(end - 1);
|
||||
|
||||
for (pos_type vpos = row_.pos(); vpos < end; ) {
|
||||
if (x_ > bv_.workWidth())
|
||||
break;
|
||||
|
||||
// Skip the separator at the logical end of the row
|
||||
if (vpos == skipped_sep_vpos) {
|
||||
++vpos;
|
||||
continue;
|
||||
}
|
||||
|
||||
pos_type const pos = bidi_.vis2log(vpos);
|
||||
|
||||
if (pos >= par_.size()) {
|
||||
|
Loading…
Reference in New Issue
Block a user