Index: trunk/src/user32/button.cpp
===================================================================
--- trunk/src/user32/button.cpp	(revision 1943)
+++ trunk/src/user32/button.cpp	(revision 1944)
@@ -1,3 +1,3 @@
-/* $Id: button.cpp,v 1.20 1999-11-24 18:21:34 cbratschi Exp $ */
+/* $Id: button.cpp,v 1.21 1999-12-02 16:34:42 cbratschi Exp $ */
 /* File: button.cpp -- Button type widgets
  *
@@ -1021,8 +1021,8 @@
     parent = GetParent(hwnd);
     /* assure that starting control is not disabled or invisible */
-    start = sibling = GetNextDlgGroupItem( parent, hwnd, TRUE );
+    //start = sibling = GetNextDlgGroupItem( parent, hwnd, TRUE );
     //@YD: bugfix
     //CB: doesn't work!
-    //start = sibling = GetNextDlgGroupItem( parent, hwnd, FALSE );
+    start = sibling = GetNextDlgGroupItem( parent, hwnd, FALSE );
     do
     {
Index: trunk/src/user32/caret.cpp
===================================================================
--- trunk/src/user32/caret.cpp	(revision 1943)
+++ trunk/src/user32/caret.cpp	(revision 1944)
@@ -1,3 +1,3 @@
-/* $Id: caret.cpp,v 1.7 1999-10-25 20:17:16 sandervl Exp $ */
+/* $Id: caret.cpp,v 1.8 1999-12-02 16:34:43 cbratschi Exp $ */
 
 /*
@@ -37,5 +37,5 @@
 static int CaretWidth, CaretHeight;
 static int CaretPosX, CaretPosY;
-static BOOL CaretIsVisible;
+static INT CaretIsVisible; //visible if > 0
 
 #pragma data_seg()
@@ -62,8 +62,9 @@
        if (rc)
        {
-           hwndCaret   = hwnd;
-           hbmCaret    = hBmp;
-           CaretWidth  = width;
-           CaretHeight = height;
+           hwndCaret      = hwnd;
+           hbmCaret       = hBmp;
+           CaretWidth     = width;
+           CaretHeight    = height;
+           CaretIsVisible = 0;
        }
 
@@ -83,5 +84,5 @@
    CaretWidth     = 0;
    CaretHeight    = 0;
-   CaretIsVisible = FALSE;
+   CaretIsVisible = 0;
 
    rc = _DestroyCaret();
@@ -218,6 +219,9 @@
    dprintf(("USER32:  ShowCaret %x", hwnd));
 
-   CaretIsVisible = TRUE;
-   rc = _ShowCaret (Win32BaseWindow::Win32ToOS2Handle (hwnd));
+   CaretIsVisible++;
+   if (CaretIsVisible == 1)
+     rc = _ShowCaret (Win32BaseWindow::Win32ToOS2Handle (hwnd));
+   else
+     rc = TRUE;
 
    return (rc);
@@ -230,6 +234,9 @@
    dprintf(("USER32:  HideCaret"));
 
-   CaretIsVisible = FALSE;
-   rc = _HideCaret (Win32BaseWindow::Win32ToOS2Handle (hwnd));
+   CaretIsVisible--;
+   if (CaretIsVisible == 0)
+     rc = _HideCaret (Win32BaseWindow::Win32ToOS2Handle (hwnd));
+   else
+     rc = TRUE;
 
    return (rc);
@@ -239,4 +246,5 @@
 {
    CURSORINFO cursorInfo;
+   INT x;
 
    if ((hwndFocus != 0) && (hwndCaret == hwndFocus) &&
@@ -247,6 +255,6 @@
       CreateCaret (hwndCaret, hbmCaret, CaretWidth, CaretHeight);
       SetCaretPos (CaretPosX, CaretPosY);
-      if (CaretIsVisible)
-         ShowCaret (hwndCaret);
-   }
-}
+      if (CaretIsVisible > 0)
+        _ShowCaret(Win32BaseWindow::Win32ToOS2Handle(hwndCaret));
+   }
+}
Index: trunk/src/user32/edit.cpp
===================================================================
--- trunk/src/user32/edit.cpp	(revision 1943)
+++ trunk/src/user32/edit.cpp	(revision 1944)
@@ -1,3 +1,3 @@
-/* $Id: edit.cpp,v 1.20 1999-12-01 18:23:27 cbratschi Exp $ */
+/* $Id: edit.cpp,v 1.21 1999-12-02 16:34:43 cbratschi Exp $ */
 /*
  *      Edit control
@@ -21,8 +21,8 @@
     new in Win98, Win2k: for single line too
   - WinNT/Win2k: higher size limits (single: 0x7FFFFFFE, multi: none)
-  - problems with OS/2 PM font kerning:
-    TabbedTextOutA
-    GetTextExtentPoint32A
-    WINE code uses relative positions -> rewrite to absolute!
+  - problems with selection update: perhaps an Open32 bug
+    TextOutA: draws at wrong position
+    I've removed the workarounds, it makes no sense to fix GDI32 bugs here
+    -> rewrite TextOut and TabbedTextOut
 */
 
@@ -1032,4 +1032,5 @@
                 rc->top = es->format_rect.top;
         rc->bottom = rc->top + es->line_height;
+
         rc->left = (scol == 0) ? es->format_rect.left : SLOWORD(EDIT_EM_PosFromChar(hwnd, es, line_index + scol, TRUE));
         rc->right = (ecol == -1) ? es->format_rect.right : SLOWORD(EDIT_EM_PosFromChar(hwnd, es, line_index + ecol, TRUE))+1;
@@ -1099,8 +1100,4 @@
 
         EDIT_GetLineRect(hwnd, es, 0, start, end, &line_rect);
-
-        //CB: fix 1 pixel vertical line bug
-        line_rect.left--;
-        line_rect.right++;
 
         if (IntersectRect(&rc, &line_rect, &es->format_rect))
@@ -1152,9 +1149,4 @@
         if (sl == el) {
                 EDIT_GetLineRect(hwnd, es, sl, sc, ec, &rcLine);
-
-                //CB: fix 1 pixel vertical line bug
-                rcLine.left--;
-                rcLine.right++;
-
 
                 if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
@@ -1582,11 +1574,12 @@
         s = MIN(li + ll, MAX(li, s));
         e = MIN(li + ll, MAX(li, e));
+
         if (rev && (s != e) &&
-                        ((es->flags & EF_FOCUSED) || (es->style & ES_NOHIDESEL))) {
-                x += EDIT_PaintText(hwnd, es, dc, x, y, line, 0, s - li, FALSE);
-                x += EDIT_PaintText(hwnd, es, dc, x, y, line, s - li, e - s, TRUE);
-                x += EDIT_PaintText(hwnd, es, dc, x, y, line, e - li, li + ll - e, FALSE);
-        } else
-                x += EDIT_PaintText(hwnd, es, dc, x, y, line, 0, ll, FALSE);
+                        ((es->flags & EF_FOCUSED) || (es->style & ES_NOHIDESEL)))
+        {
+          x += EDIT_PaintText(hwnd, es, dc, x, y, line, 0, s - li, FALSE);
+          x += EDIT_PaintText(hwnd, es, dc, x, y, line, s - li, e - s, TRUE);
+          x += EDIT_PaintText(hwnd, es, dc, x, y, line, e - li, li + ll - e, FALSE);
+        } else  EDIT_PaintText(hwnd, es, dc, x, y, line, 0, ll, FALSE);
 }
 
@@ -1603,5 +1596,4 @@
         INT ret;
         INT li;
-        SIZE size;
 
         if (!count)
@@ -1617,11 +1609,19 @@
                 ret = (INT)LOWORD(TabbedTextOutA(dc, x, y, es->text + li + col, count,
                                         es->tabs_count, es->tabs, es->format_rect.left - es->x_offset));
-        } else {
-                LPSTR text = EDIT_GetPasswordPointer_SL(hwnd, es);
-                TextOutA(dc, x, y, text + li + col, count);
-                GetTextExtentPoint32A(dc, text + li + col, count, &size);
-                ret = size.cx;
-                if (es->style & ES_PASSWORD)
-                        HeapFree(es->heap, 0, text);
+        } else
+        {
+          LPSTR text = EDIT_GetPasswordPointer_SL(hwnd, es);
+          POINT pt;
+          UINT oldAlign = GetTextAlign(dc);
+
+          MoveToEx(dc,x,y,NULL);
+          SetTextAlign(dc,(oldAlign & ~TA_NOUPDATECP) | TA_UPDATECP);
+
+          TextOutA(dc,x,y,text+li+col,count);
+          GetCurrentPositionEx(dc,&pt);
+          SetTextAlign(dc,oldAlign);
+          ret = pt.x-x;
+          if (es->style & ES_PASSWORD)
+            HeapFree(es->heap, 0, text);
         }
         if (rev) {
@@ -2197,18 +2197,18 @@
                 x = LOWORD(GetTabbedTextExtentA(dc, es->text + li, index - li,
                                 es->tabs_count, es->tabs)) - es->x_offset;
-        } else {
-                LPSTR text = EDIT_GetPasswordPointer_SL(hwnd, es);
-                if (index < es->x_offset) {
-                        GetTextExtentPoint32A(dc, text + index,
-                                        es->x_offset - index, &size);
-                        x = -size.cx;
-                } else {
-                        GetTextExtentPoint32A(dc, text + es->x_offset,
-                                        index - es->x_offset, &size);
-                         x = size.cx;
-                }
-                y = 0;
-                if (es->style & ES_PASSWORD)
-                        HeapFree(es->heap, 0 ,text);
+        } else
+        {
+          LPSTR text = EDIT_GetPasswordPointer_SL(hwnd, es);
+
+          GetTextExtentPoint32A(dc,text,index,&size);
+          x = size.cx;
+          if (es->x_offset)
+          {
+            GetTextExtentPoint32A(dc,text,es->x_offset,&size);
+            x -= size.cx;
+          }
+          y = 0;
+          if (es->style & ES_PASSWORD)
+            HeapFree(es->heap, 0 ,text);
         }
         x += es->format_rect.left;
@@ -3778,5 +3778,5 @@
         if (!GetTextMetricsA(dc, &tm))
         {
-          SelectObject(dc,old_font);
+          if (font) SelectObject(dc,old_font);
           ReleaseDC(hwnd,dc);
 
