]> granicus.if.org Git - vim/commitdiff
updated for version 7.2-093 v7.2.093
authorBram Moolenaar <Bram@vim.org>
Wed, 28 Jan 2009 20:23:17 +0000 (20:23 +0000)
committerBram Moolenaar <Bram@vim.org>
Wed, 28 Jan 2009 20:23:17 +0000 (20:23 +0000)
src/gui_w32.c
src/gui_w48.c
src/version.c

index a36f9766afe2808c348394109dd5ec5266b6ac51..164e8c614e9e3a65ec4915278070974b3b295c04 100644 (file)
@@ -1582,6 +1582,17 @@ gui_mch_init(void)
     s_findrep_struct.lpstrReplaceWith[0] = NUL;
     s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE;
     s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE;
+# if defined(FEAT_MBYTE) && defined(WIN3264)
+    s_findrep_struct_w.lStructSize = sizeof(s_findrep_struct_w);
+    s_findrep_struct_w.lpstrFindWhat =
+                             (LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR));
+    s_findrep_struct_w.lpstrFindWhat[0] = NUL;
+    s_findrep_struct_w.lpstrReplaceWith =
+                             (LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR));
+    s_findrep_struct_w.lpstrReplaceWith[0] = NUL;
+    s_findrep_struct_w.wFindWhatLen = MSWIN_FR_BUFSIZE;
+    s_findrep_struct_w.wReplaceWithLen = MSWIN_FR_BUFSIZE;
+# endif
 #endif
 
 theend:
@@ -2938,8 +2949,27 @@ dialog_callback(
 
        /* If the edit box exists, copy the string. */
        if (s_textfield != NULL)
-           GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2,
+       {
+# if defined(FEAT_MBYTE) && defined(WIN3264)
+           /* If the OS is Windows NT, and 'encoding' differs from active
+            * codepage: use wide function and convert text. */
+           if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
+                   && enc_codepage >= 0 && (int)GetACP() != enc_codepage)
+            {
+              WCHAR  *wp = (WCHAR *)alloc(IOSIZE * sizeof(WCHAR));
+              char_u *p;
+
+              GetDlgItemTextW(hwnd, DLG_NONBUTTON_CONTROL + 2, wp, IOSIZE);
+              p = utf16_to_enc(wp, NULL);
+              vim_strncpy(s_textfield, p, IOSIZE);
+              vim_free(p);
+              vim_free(wp);
+           }
+           else
+# endif
+               GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2,
                                                         s_textfield, IOSIZE);
+       }
 
        /*
         * Need to check for IDOK because if the user just hits Return to
index 76ed6b79db91a05f1002a9481db9aad0f5857f78..123584bb142af955250c712dfa47eb0cc52e1249 100644 (file)
@@ -153,6 +153,9 @@ static int          destroying = FALSE;     /* call DestroyWindow() ourselves */
 #ifdef MSWIN_FIND_REPLACE
 static UINT            s_findrep_msg = 0;      /* set in gui_w[16/32].c */
 static FINDREPLACE     s_findrep_struct;
+# if defined(FEAT_MBYTE) && defined(WIN3264)
+static FINDREPLACEW    s_findrep_struct_w;
+# endif
 static HWND            s_findrep_hwnd = NULL;
 static int             s_findrep_is_find;      /* TRUE for find dialog, FALSE
                                                   for find/replace dialog */
@@ -884,6 +887,45 @@ _OnMenu(
 #endif
 
 #ifdef MSWIN_FIND_REPLACE
+# if defined(FEAT_MBYTE) && defined(WIN3264)
+/*
+ * copy useful data from structure LPFINDREPLACE to structure LPFINDREPLACEW
+ */
+    static void
+findrep_atow(LPFINDREPLACEW lpfrw, LPFINDREPLACE lpfr)
+{
+    WCHAR *wp;
+
+    lpfrw->hwndOwner = lpfr->hwndOwner;
+    lpfrw->Flags = lpfr->Flags;
+
+    wp = enc_to_utf16(lpfr->lpstrFindWhat, NULL);
+    wcsncpy(lpfrw->lpstrFindWhat, wp, lpfrw->wFindWhatLen - 1);
+    vim_free(wp);
+
+    /* the field "lpstrReplaceWith" doesn't need to be copied */
+}
+
+/*
+ * copy useful data from structure LPFINDREPLACEW to structure LPFINDREPLACE
+ */
+    static void
+findrep_wtoa(LPFINDREPLACE lpfr, LPFINDREPLACEW lpfrw)
+{
+    char_u *p;
+
+    lpfr->Flags = lpfrw->Flags;
+
+    p = utf16_to_enc(lpfrw->lpstrFindWhat, NULL);
+    vim_strncpy(lpfr->lpstrFindWhat, p, lpfr->wFindWhatLen - 1);
+    vim_free(p);
+
+    p = utf16_to_enc(lpfrw->lpstrReplaceWith, NULL);
+    vim_strncpy(lpfr->lpstrReplaceWith, p, lpfr->wReplaceWithLen - 1);
+    vim_free(p);
+}
+# endif
+
 /*
  * Handle a Find/Replace window message.
  */
@@ -893,6 +935,16 @@ _OnFindRepl(void)
     int            flags = 0;
     int            down;
 
+# if defined(FEAT_MBYTE) && defined(WIN3264)
+    /* If the OS is Windows NT, and 'encoding' differs from active codepage:
+     * convert text from wide string. */
+    if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
+                       && enc_codepage >= 0 && (int)GetACP() != enc_codepage)
+    {
+        findrep_wtoa(&s_findrep_struct, &s_findrep_struct_w);
+    }
+# endif
+
     if (s_findrep_struct.Flags & FR_DIALOGTERM)
        /* Give main window the focus back. */
        (void)SetFocus(s_hwnd);
@@ -2562,7 +2614,19 @@ gui_mch_find_dialog(exarg_T *eap)
        if (!IsWindow(s_findrep_hwnd))
        {
            initialise_findrep(eap->arg);
-           s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct);
+# if defined(FEAT_MBYTE) && defined(WIN3264)
+           /* If the OS is Windows NT, and 'encoding' differs from active
+            * codepage: convert text and use wide function. */
+           if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
+                   && enc_codepage >= 0 && (int)GetACP() != enc_codepage)
+           {
+               findrep_atow(&s_findrep_struct_w, &s_findrep_struct);
+               s_findrep_hwnd = FindTextW(
+                                       (LPFINDREPLACEW) &s_findrep_struct_w);
+           }
+           else
+# endif
+               s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct);
        }
 
        set_window_title(s_findrep_hwnd,
@@ -2587,7 +2651,18 @@ gui_mch_replace_dialog(exarg_T *eap)
        if (!IsWindow(s_findrep_hwnd))
        {
            initialise_findrep(eap->arg);
-           s_findrep_hwnd = ReplaceText((LPFINDREPLACE) &s_findrep_struct);
+# if defined(FEAT_MBYTE) && defined(WIN3264)
+           if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
+                   && enc_codepage >= 0 && (int)GetACP() != enc_codepage)
+           {
+               findrep_atow(&s_findrep_struct_w, &s_findrep_struct);
+               s_findrep_hwnd = ReplaceTextW(
+                                       (LPFINDREPLACEW) &s_findrep_struct_w);
+           }
+           else
+# endif
+               s_findrep_hwnd = ReplaceText(
+                                          (LPFINDREPLACE) &s_findrep_struct);
        }
 
        set_window_title(s_findrep_hwnd,
index ad17ab62e0a57618db970bac2a914d522d116a08..06abbfc5c1e6a05efb3bbc4c0ec565a68d3a823d 100644 (file)
@@ -676,6 +676,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    93,
 /**/
     92,
 /**/