Slight correction of the EPM patch: there are these exceptions of the logic to avoid double spaces:

abc [WERBEH|] def"
abc [ WERBEH]|def"
abc|[WERBEH ]def"
abc[|WERBEH] def"

All 4 should be possible, i.e. a space should be inserted. The last two don't fulfill the condition that the previous character is a space, so they are accepted anyway. The first two have the property that we are on a bidi boundary and the cursor boundary flag is false. So the following patch is implementing that.

Stefan

Index: src/Text.cpp
===================================================================
--- src/Text.cpp        (Revision 18626)
+++ src/Text.cpp        (Arbeitskopie)
@@ -731,8 +732,13 @@
                        return;
                }
                BOOST_ASSERT(cur.pos() > 0);
+               // no space if previous was space (or newline),
+ // but allow spaces on both sides of RTL boundaries (bidi.isBoundary && !boundary),
+               // i.e. "abc [WERBEH|] def"
+               // and  "abc [ WERBEH]|def"
if ((par.isLineSeparator(cur.pos() - 1) || par.isNewline(cur.pos() - 1))
-                   && !par.isDeleted(cur.pos() - 1)) {
+                   && !par.isDeleted(cur.pos() - 1)
+ && !(bidi.isBoundary(cur.buffer(), par, cur.pos()) && ! cur.boundary())) {
                        static bool sent_space_message = false;
                        if (!sent_space_message) {
                                cur.message(_("You cannot type two spaces this way. 
"
Index: src/Text2.cpp
===================================================================
--- src/Text2.cpp       (Revision 18626)
+++ src/Text2.cpp       (Arbeitskopie)
@@ -1154,7 +1160,8 @@
                    && old.pos() < oldpar.size()
                    && oldpar.isLineSeparator(old.pos())
                    && oldpar.isLineSeparator(old.pos() - 1)
-                   && !oldpar.isDeleted(old.pos() - 1)) {
+                   && !oldpar.isDeleted(old.pos() - 1)
+                               && !old.text()->bidi.isBoundary(old.buffer(), 
oldpar, old.pos())) {
                        oldpar.eraseChar(old.pos() - 1, 
cur.buffer().params().trackChanges);
#ifdef WITH_WARNINGS
#warning This will not work anymore when we have multiple views of the same buffer

Attachment: rtlepm.patch
Description: Binary data

Attachment: PGP.sig
Description: Signierter Teil der Nachricht

Reply via email to