poedit icon indicating copy to clipboard operation
poedit copied to clipboard

msgctxt in RTL layout causes mirroring and garbled rendering

Open SafaAlfulaij opened this issue 7 years ago • 1 comments

Using Windows 10 and Arabic interface.

If there is a string that has msgctxt, showing in the listview, the mirroring of the "new-painted" items is reversed. For example, if PoEdit's window is big enough to show 32 strings (File below), then all of the strings are mirrored wrongly when opened the file, as all of them are newly painted. If it was small and able to just show less than 32 (The last string is the msgctxt one), then the first strings will be right, till you reach that string (and it's mirrored) by scrolling. Now if you scroll up you'll see the old strings mirrored while they were right. I'm having problems recording video. If needed, I'll try again. For now some screenshots:

All visible right: poeditrtl1 All visible right: poeditrtl2 Last one is mirrored: poeditrtl3 Top one is mirrored while it was right: poeditrtl4

Test file:

msgid "Blender Reference Manual 1"
msgstr ""

msgid "Blender Reference Manual 2"
msgstr ""

msgid "Blender Reference Manual 3"
msgstr ""

msgid "Blender Reference Manual 4"
msgstr ""

msgid "Blender Reference Manual 5"
msgstr ""

msgid "Blender Reference Manual 6"
msgstr ""

msgid "Blender Reference Manual 7"
msgstr ""

msgid "Blender Reference Manual 8"
msgstr ""

msgid "Blender Reference Manual 9"
msgstr ""

msgid "Blender Reference Manual 10"
msgstr ""

msgid "Blender Reference Manual 11"
msgstr ""

msgid "Blender Reference Manual 12"
msgstr ""

msgid "Blender Reference Manual 13"
msgstr ""

msgid "Blender Reference Manual 14"
msgstr ""

msgid "Blender Reference Manual 15"
msgstr ""

msgid "Blender Reference Manual 16"
msgstr ""

msgid "Blender Reference Manual 17"
msgstr ""

msgid "Blender Reference Manual 18"
msgstr ""

msgid "Blender Reference Manual 19"
msgstr ""

msgid "Blender Reference Manual 20"
msgstr ""

msgid "Blender Reference Manual 21"
msgstr ""

msgid "Blender Reference Manual 22"
msgstr ""

msgid "Blender Reference Manual 23"
msgstr ""

msgid "Blender Reference Manual 24"
msgstr ""

msgid "Blender Reference Manual 25"
msgstr ""

msgid "Blender Reference Manual 26"
msgstr ""

msgid "Blender Reference Manual 27"
msgstr ""

msgid "Blender Reference Manual 28"
msgstr ""

msgid "Blender Reference Manual 29"
msgstr ""

msgid "Blender Reference Manual 30"
msgstr ""

msgid "Blender Reference Manual 31"
msgstr ""

msgid "Blender Reference Manual 32"
msgstr ""

msgctxt "Sound"
msgid "Blender Reference Manual"
msgstr ""

SafaAlfulaij avatar Mar 04 '17 14:03 SafaAlfulaij

Note to self: this alone (tagging markup segments and terminating with PDF) is not sufficient to fix the bug:

diff --git a/src/edlistctrl.cpp b/src/edlistctrl.cpp
index f331025a6..977a02326 100644
--- a/src/edlistctrl.cpp
+++ b/src/edlistctrl.cpp
@@ -317,6 +317,14 @@ void PoeditListCtrl::Model::GetValueByRow(wxVariant& variant, unsigned row, unsi
 #if wxCHECK_VERSION(3,1,1)
             if (d->HasContext())
             {
+                wxString context = EscapeMarkup(d->GetContext());
+                wxString srcstring = EscapeMarkup(d->GetString());
+                if (m_appTextDir != m_sourceTextDir)
+                {
+                    context = bidi::mark_direction(context, m_sourceTextDir);
+                    srcstring = bidi::mark_direction(context, m_sourceTextDir);
+                }
+
                 // Work around a problem with GTK+'s coloring of markup that begins with colorizing <span>:
                 #ifdef __WXGTK__
                     #define MARKUP(x) L"\u200B" L##x
@@ -325,7 +333,7 @@ void PoeditListCtrl::Model::GetValueByRow(wxVariant& variant, unsigned row, unsi
                 #endif
                 orig.Printf(MARKUP("<span bgcolor=\"%s\" color=\"%s\"> %s </span> %s"),
                             m_clrContextBg, m_clrContextFg,
-                            EscapeMarkup(d->GetContext()), EscapeMarkup(d->GetString()));
+                            context, srcstring);
             }
             else
             {
diff --git a/src/unicode_helpers.cpp b/src/unicode_helpers.cpp
index 9fb2dd97a..3b739c93d 100644
--- a/src/unicode_helpers.cpp
+++ b/src/unicode_helpers.cpp
@@ -133,6 +133,7 @@ wxString mark_direction(const wxString& text, TextDirection dir)
     replacement[1] = mark;
     out.Replace("\n", replacement);
 #endif
+    out += PDF;
     return out;
 }

Something truly weird is going on in wxDVC markup rendering.

vslavik avatar Mar 26 '17 13:03 vslavik