mlang: Partially implement IMLangLineBreakConsole::BreakLineW

Igor Izyumin igor.izyumin at gmail.com
Sat Jul 19 12:55:42 CDT 2014


The BreakLineW stub currently does not do anything.  Since this method
is typically used in a loop to word-wrap a string, it causes programs
that use it (e.g. Mathcad) to hang when they attempt to break a line
(bug 32126).
-------------- next part --------------
From 5670e308d84a7db29f5488a28f2357fd6cec940e Mon Sep 17 00:00:00 2001
From: Igor Izyumin <igor.izyumin at gmail.com>
Date: Sat, 19 Jul 2014 10:31:26 -0700
Subject: Partial implementation of IMLangLineBreakConsole::BreakLineW to
 address bug 32126

---
 dlls/mlang/mlang.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c
index f4a689c..6c28cc8 100644
--- a/dlls/mlang/mlang.c
+++ b/dlls/mlang/mlang.c
@@ -3466,10 +3466,31 @@ static HRESULT WINAPI fnIMLangLineBreakConsole_BreakLineW(
     LONG* pcchLine,
     LONG* pcchSkip )
 {
-    FIXME("(%p)->%i %s %i %i %p %p\n", iface, locale, debugstr_wn(pszSrc,cchSrc), cchSrc, cMaxColumns, pcchLine, pcchSkip);
+    LONG i;
 
     *pcchLine = cchSrc;
     *pcchSkip = 0;
+
+    FIXME("(%p)->%i %s %i %i %p %p\n", iface, locale, debugstr_wn(pszSrc,cchSrc), cchSrc, cMaxColumns, pcchLine, pcchSkip);
+
+    if (cchSrc > cMaxColumns)
+    {
+        for (i = cMaxColumns - 1; i >= 0; i--)
+        {
+            if (isspaceW(pszSrc[i]))
+            {
+                do
+                {
+                    i--;
+                    (*pcchSkip)++;
+                }
+                while(i >= 0 && isspaceW(pszSrc[i]));
+                break;
+            }
+        }
+        *pcchLine = i+1;
+    }
+
     return S_OK;
 }
 
-- 
1.9.1



More information about the wine-patches mailing list