Alex Villacís Lasso : riched32: Implement a portion of suggested interpretation of CRLF handling for richedit 1 .0 emulation.

Alexandre Julliard julliard at winehq.org
Tue Apr 22 06:47:05 CDT 2008


Module: wine
Branch: master
Commit: 820de0bd595656d2f27863232d96104224d6e158
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=820de0bd595656d2f27863232d96104224d6e158

Author: Alex Villacís Lasso <a_villacis at palosanto.com>
Date:   Mon Apr 21 10:10:05 2008 -0500

riched32: Implement a portion of suggested interpretation of CRLF handling for richedit 1.0 emulation.

Fixes a few todos introduced by previous patch.

---

 dlls/riched20/caret.c        |   23 +++++++++++++++++++----
 dlls/riched32/tests/editor.c |    6 +++---
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index a6a6217..7d50460 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -537,10 +537,25 @@ void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor,
       ME_ReleaseStyle(end_run->member.run.style);
       end_run->member.run.style = tmp_style;
       p->nOffset = 0;
-      if(pos-str < len && *pos =='\r')
-        pos++;
-      if(pos-str < len && *pos =='\n')
-        pos++;
+      if (editor->bEmulateVersion10) {
+        const WCHAR * tpos;
+
+        tpos = pos;
+        while (tpos-str < len && *tpos == '\r') {
+          tpos++;
+        }
+        if (tpos-str >= len) {
+          if (tpos != pos) pos++;
+        } else if (*tpos == '\n')
+          pos = tpos + 1;
+        else
+          pos++;
+      } else {
+        if(pos-str < len && *pos =='\r')
+          pos++;
+        if(pos-str < len && *pos =='\n')
+          pos++;
+      }
       if(pos-str <= len) {
         len -= pos - str;
         str = pos;
diff --git a/dlls/riched32/tests/editor.c b/dlls/riched32/tests/editor.c
index f6f04af..906623f 100644
--- a/dlls/riched32/tests/editor.c
+++ b/dlls/riched32/tests/editor.c
@@ -113,9 +113,9 @@ static void test_WM_SETTEXT()
   TEST_SETTEXT(TestItem2, TestItem2, 1, 1, 1)
   TEST_SETTEXT(TestItem3, TestItem3, 2, 1, 1)
   TEST_SETTEXT(TestItem4, TestItem4, 3, 1, 0)
-  TEST_SETTEXT(TestItem5, TestItem5, 2, 1, 1)
-  TEST_SETTEXT(TestItem6, TestItem6, 3, 1, 1)
-  TEST_SETTEXT(TestItem7, TestItem7, 4, 1, 1)
+  TEST_SETTEXT(TestItem5, TestItem5, 2, 1, 0)
+  TEST_SETTEXT(TestItem6, TestItem6, 3, 1, 0)
+  TEST_SETTEXT(TestItem7, TestItem7, 4, 1, 0)
   TEST_SETTEXT(TestItem8, TestItem8, 2, 0, 0)
   TEST_SETTEXT(TestItem9, TestItem9, 3, 0, 0)
   TEST_SETTEXT(TestItem10, TestItem10, 3, 0, 0)




More information about the wine-cvs mailing list