Huw Davies : riched20: Add support for quoting urls with spaces within '<' '>'.

Alexandre Julliard julliard at winehq.org
Wed Jun 1 10:45:45 CDT 2016


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Jun  1 12:35:38 2016 +0100

riched20: Add support for quoting urls with spaces within '<' '>'.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/riched20/editor.c | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index d4ca570..a07dd7f 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -5038,8 +5038,8 @@ static BOOL ME_FindNextURLCandidate(ME_TextEditor *editor,
                                     ME_Cursor *candidate_min,
                                     ME_Cursor *candidate_max)
 {
-  ME_Cursor cursor = *start, neutral_end;
-  BOOL candidateStarted = FALSE;
+  ME_Cursor cursor = *start, neutral_end, space_end;
+  BOOL candidateStarted = FALSE, quoted = FALSE;
   WCHAR c;
 
   while (nChars > 0)
@@ -5060,9 +5060,11 @@ static BOOL ME_FindNextURLCandidate(ME_TextEditor *editor,
           *candidate_min = cursor;
           candidateStarted = TRUE;
           neutral_end.pPara = NULL;
+          space_end.pPara = NULL;
           cursor.nOffset++;
           break;
         }
+        quoted = (c == '<');
         cursor.nOffset++;
       }
     }
@@ -5074,9 +5076,28 @@ static BOOL ME_FindNextURLCandidate(ME_TextEditor *editor,
       {
         c = str[cursor.nOffset];
         if (isspaceW( c ))
-          goto done;
+        {
+          if (quoted && c != '\r')
+          {
+            if (!space_end.pPara)
+            {
+              if (neutral_end.pPara)
+                space_end = neutral_end;
+              else
+                space_end = cursor;
+            }
+          }
+          else
+            goto done;
+        }
         else if (isurlneutral( c ))
         {
+          if (quoted && c == '>')
+          {
+            neutral_end.pPara = NULL;
+            space_end.pPara = NULL;
+            goto done;
+          }
           if (!neutral_end.pPara)
             neutral_end = cursor;
         }
@@ -5095,7 +5116,9 @@ static BOOL ME_FindNextURLCandidate(ME_TextEditor *editor,
 done:
   if (candidateStarted)
   {
-    if (neutral_end.pPara)
+    if (space_end.pPara)
+      *candidate_max = space_end;
+    else if (neutral_end.pPara)
       *candidate_max = neutral_end;
     else
       *candidate_max = cursor;




More information about the wine-cvs mailing list