# HG changeset patch
# User Tim Worthington
# Date 1500650935 -36000
#      Sat Jul 22 01:28:55 2017 +1000
# Node ID d940377170e5039895aaf303c6c1b4be4c579c4a
# Parent  c5c8ef267215ddf6f4168f588daf0c2f5a8730f0
user32: fix rendering of tabs in edit control

Fixes https://bugs.winehq.org/show_bug.cgi?id=33834

Tested on Linux Mint 18 (compared operation with Windows 7)

Signed-off-by: Tim Worthington <tim@pcbelegance.org>

diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -411,7 +411,7 @@
 			old_font = SelectObject(udc, es->font);
 
 		tabdef.cTabStops = es->tabs_count;
-		tabdef.iScale = 0;
+		tabdef.iScale = GdiGetCharDimensions(udc, NULL, NULL);
 		tabdef.pTabStops = es->tabs;
 		tabdef.iTabOrigin = 0;
 
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -1828,7 +1828,12 @@
         cTabStops = 0;
     }
     else
-        defWidth = 8 * psc->tm.tmAveCharWidth;
+    {
+        if (pTabdef->iScale)
+            defWidth = (32 * pTabdef->iScale) / 4;
+        else
+            defWidth = 8 * psc->tm.tmAveCharWidth;
+    }
 
     for (; cTabStops>0 ; lpTabPos++, cTabStops--)
     {
@@ -1842,10 +1847,10 @@
 
         if( nTabOrg + position > current_x)
         {
-            if( *lpTabPos >= 0)
+            if( position >= 0)
             {
                 /* a left aligned tab */
-                x = (nTabOrg + *lpTabPos) - current_x;
+                x = (nTabOrg + position) - current_x;
                 break;
             }
             else
