home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.1.228 < prev    next >
Encoding:
Internet Message Format  |  2002-10-14  |  13.0 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.228 (extra)
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.1.228 (extra)
  11. Problem:    Win32: The special output function for Hangul is used too often,
  12.         causing special handling for other situations to be skipped.
  13.         bInComposition is always FALSE, causing ImeGetTempComposition()
  14.         always to return NULL.
  15. Solution:   Remove HanExtTextOut().  Delete the dead code around
  16.         bInComposition and ImeGetTempComposition().
  17. Files:        src/gui_w16.c, src/gui_w32.c, src/gui_w48.c
  18.  
  19.  
  20. *** ../vim61.227/src/gui_w16.c    Sun Jun  9 20:34:00 2002
  21. --- src/gui_w16.c    Tue Oct 15 21:00:14 2002
  22. ***************
  23. *** 356,365 ****
  24.   #endif
  25.           return 0;
  26.   
  27. -     case WM_CREATE:    /* HANDLE_MSG doesn't seem to handle this one */
  28. -     return _OnCreate (hwnd, (LPCREATESTRUCT)lParam);
  29.   #if defined(MENUHINTS) && defined(FEAT_MENU)
  30.       case WM_MENUSELECT:
  31.       if (((UINT) LOWORD(lParam)
  32. --- 356,361 ----
  33. ***************
  34. *** 764,772 ****
  35.        */
  36.       HBRUSH    hbr;
  37.       RECT    rc;
  38. - #ifdef FEAT_MBYTE_IME
  39. -     char    *szComp;
  40. - #endif
  41.   
  42.       if (!(flags & DRAW_TRANSP))
  43.       {
  44. --- 760,765 ----
  45. *** ../vim61.227/src/gui_w32.c    Mon Oct 14 20:18:19 2002
  46. --- src/gui_w32.c    Tue Oct 15 21:00:20 2002
  47. ***************
  48. *** 729,737 ****
  49.   #endif
  50.           return 0;
  51.   
  52. -     case WM_CREATE:    /* HANDLE_MSG doesn't seem to handle this one */
  53. -     return _OnCreate (hwnd, (LPCREATESTRUCT)lParam);
  54.       case WM_SIZING:    /* HANDLE_MSG doesn't seem to handle this one */
  55.       return _DuringSizing(hwnd, (UINT)wParam, (LPRECT)lParam);
  56.   
  57. --- 729,734 ----
  58. ***************
  59. *** 1237,1244 ****
  60.   }
  61.   
  62.   
  63.   /*
  64.    * Set the current text foreground color.
  65.    */
  66. --- 1234,1239 ----
  67. ***************
  68. *** 1259,1341 ****
  69.   
  70.   #if defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)
  71.   /*
  72. !  * Multi-byte handling, by Sung-Hoon Baek
  73.    * First static functions (no prototypes generated).
  74.    */
  75.   
  76. -     static void
  77. - HanExtTextOut(HDC hdc, int X, int Y, UINT fuOption, const RECT *lprc,
  78. -     LPCTSTR lpString, UINT cbCount, const int *lpDx, BOOL bOpaque)
  79. - {
  80. -     LPCTSTR    pszTemp;
  81. -     int        i;
  82. -     HPEN    hpen, old_pen;
  83. -     POINT    point;
  84. -     int        n;
  85. -     if (gui.char_width == sysfixed_width && gui.char_height == sysfixed_height)
  86. -     {
  87. -     hpen = CreatePen(PS_SOLID, 2, gui.currFgColor);
  88. -     old_pen = SelectObject(hdc, hpen);
  89. -     pszTemp = lpString;
  90. -     i = 0;
  91. -     while (cbCount > 0)
  92. -     {
  93. -         if (cbCount > 1 && (n = MB_BYTE2LEN(*(char_u *)pszTemp)) > 1)
  94. -         {
  95. -         cbCount -= n;
  96. -         pszTemp += n;
  97. -         i += n;
  98. -         }
  99. -         else if (*pszTemp == '\\')
  100. -         {
  101. -         if (i > 0)
  102. -             ExtTextOut(hdc, X+((pszTemp-i)-lpString)*gui.char_width, Y,
  103. -                 fuOption, lprc, pszTemp-i, i, lpDx);
  104. -         MoveToEx(hdc, (int)(X+(pszTemp-lpString)*gui.char_width
  105. -                 + gui.char_width*0.2),
  106. -             (int)(Y + gui.char_height*0.2), &point);
  107. -         LineTo(hdc, (int)(X+(pszTemp-lpString)*gui.char_width
  108. -                 + gui.char_width*0.8),
  109. -             (int)(Y + gui.char_height*0.75));
  110. -         pszTemp++;
  111. -         cbCount--;
  112. -         i = 0;
  113. -         }
  114. -         else
  115. -         {
  116. -         pszTemp++;
  117. -         cbCount--;
  118. -         i++;
  119. -         }
  120. -     }
  121. -     if (i > 0)
  122. -     {
  123. -         int OldBkMode = 0;
  124. -         if (bOpaque)
  125. -         {
  126. -         OldBkMode = GetBkMode(hdc);
  127. -         SetBkMode(hdc, OPAQUE);
  128. -         }
  129. -         ExtTextOut(hdc, X+((pszTemp-i)-lpString)*gui.char_width, Y,
  130. -             fuOption, lprc, pszTemp-i, i, lpDx);
  131. -         if (bOpaque)
  132. -         SetBkMode(hdc, OldBkMode);
  133. -     }
  134. -     DeleteObject(SelectObject(hdc, old_pen));
  135. -     }
  136. -     else
  137. -     ExtTextOut(hdc, X, Y, fuOption, lprc, lpString, cbCount, lpDx);
  138. - }
  139.   #include <ime.h>
  140.   #include <imm.h>
  141.   
  142. - static BOOL bInComposition=FALSE;
  143.   /*
  144.    * display composition string(korean)
  145.    */
  146. --- 1254,1266 ----
  147.   
  148.   #if defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)
  149.   /*
  150. !  * Multi-byte handling, originally by Sung-Hoon Baek.
  151.    * First static functions (no prototypes generated).
  152.    */
  153.   
  154.   #include <ime.h>
  155.   #include <imm.h>
  156.   
  157.   /*
  158.    * display composition string(korean)
  159.    */
  160. ***************
  161. *** 1495,1523 ****
  162.       vim_free(buf);
  163.       return convbuf;
  164.   }
  165. -     static char_u *
  166. - ImeGetTempComposition(void)
  167. - {
  168. -     if (bInComposition == TRUE)
  169. -     {
  170. -     HIMC    hImc;
  171. -     DWORD   dwConvMode, dwSentMode;
  172. -     if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)))
  173. -     {
  174. -         pImmGetConversionStatus(hImc, &dwConvMode, &dwSentMode);
  175. -         pImmReleaseContext(s_hwnd, hImc);
  176. -         if (dwConvMode & IME_CMODE_NATIVE)
  177. -         {
  178. -         return GetResultStr(s_hwnd, GCS_COMPSTR);
  179. -         }
  180. -     }
  181. -     }
  182. -     return NULL;
  183. - }
  184.   #endif
  185.   /* For global functions we need prototypes. */
  186.   #if (defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)) || defined(PROTO)
  187.   
  188. --- 1420,1427 ----
  189.       vim_free(buf);
  190.       return convbuf;
  191.   }
  192.   #endif
  193.   /* For global functions we need prototypes. */
  194.   #if (defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)) || defined(PROTO)
  195.   
  196. ***************
  197. *** 1722,1730 ****
  198.       static int        brush_lru = 0;
  199.       HBRUSH        hbr;
  200.       RECT        rc;
  201. - #ifdef FEAT_MBYTE_IME
  202. -     char_u        *szComp;
  203. - #endif
  204.   
  205.       if (!(flags & DRAW_TRANSP))
  206.       {
  207. --- 1626,1631 ----
  208. ***************
  209. *** 1813,1914 ****
  210.        * versions.
  211.        * No check for DRAW_BOLD, Windows will have done it already.
  212.        */
  213. ! #ifdef FEAT_MBYTE_IME
  214. !     if (enc_dbcs != 0)
  215. !     {
  216. !     /* draw an incomplete composition character (korean) */
  217. !     if (len == 1 && blink_state == BLINK_ON
  218. !         && (szComp = ImeGetTempComposition()) != NULL) // hangul
  219. !     {
  220. !         HanExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row),
  221. !                    foptions, pcliprect, szComp, 2, padding, TRUE);
  222. !         vim_free(szComp);
  223.       }
  224.       else
  225. !         HanExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row),
  226. !               foptions, pcliprect, (char *)text, len, padding, FALSE);
  227.       }
  228.       else
  229.   #endif
  230.       {
  231. ! #ifdef FEAT_MBYTE
  232. !     /* Check if there are any UTF-8 characters.  If not, use normal text
  233. !      * output to speed up output. */
  234. !     if (enc_utf8)
  235. !         for (n = 0; n < len; ++n)
  236. !         if (text[n] >= 0x80)
  237. !             break;
  238. !     /* Check if the Unicode buffer exists and is big enough.  Create it
  239. !      * with the same lengt as the multi-byte string, the number of wide
  240. !      * characters is always equal or smaller. */
  241. !     if ((enc_utf8 || is_funky_dbcs)
  242. !         && (unicodebuf == NULL || len > unibuflen))
  243. !     {
  244. !         vim_free(unicodebuf);
  245. !         unicodebuf = (WCHAR *)alloc(len * sizeof(WCHAR));
  246. !         unibuflen = len;
  247. !     }
  248. !     if (enc_utf8 && n < len && unicodebuf != NULL)
  249.       {
  250. -         /* Output UTF-8 characters.  Caller has already separated
  251. -          * composing characters. */
  252. -         int        i = 0;
  253. -         int        clen;    /* string length up to composing char */
  254. -         int        cells;    /* cell width of string up to composing char */
  255. -         cells = 0;
  256. -         for (clen = 0; i < len; )
  257. -         {
  258. -         unicodebuf[clen] = utf_ptr2char(text + i);
  259. -         cells += utf_char2cells(unicodebuf[clen]);
  260. -         i += utfc_ptr2len_check_len(text + i, len - i);
  261. -         ++clen;
  262. -         }
  263.           if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT)
  264. !         ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
  265. !                  foptions | ETO_IGNORELANGUAGE,
  266. !                        pcliprect, unicodebuf, clen, NULL);
  267.           else
  268. !         ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
  269. !                  foptions, pcliprect, unicodebuf, clen, NULL);
  270. !         len = cells;    /* used for underlining */
  271. !     }
  272. !     else if (is_funky_dbcs)
  273. !     {
  274. !         /* If we want to display DBCS, and the current CP is not the DBCS
  275. !          * one, we need to go via Unicode. */
  276. !         if (unicodebuf != NULL)
  277. !         {
  278. !         if ((len = MultiByteToWideChar(enc_dbcs,
  279. !                 MB_PRECOMPOSED,
  280. !                 (char *)text, len,
  281. !                 (LPWSTR)unicodebuf, unibuflen)))
  282. !             ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
  283. !                   foptions, pcliprect, unicodebuf, len, NULL);
  284. !         }
  285.       }
  286.       else
  287.   #endif
  288. !     {
  289. ! #ifdef FEAT_RIGHTLEFT
  290. !         /* ron: fixed Hebrew on Win98/Win2000 */
  291. !         if (curwin->w_p_rl)
  292. !         {
  293. !         if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT)
  294. !             ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row),
  295. !                  foptions | ETO_IGNORELANGUAGE,
  296. !                        pcliprect, (char *)text, len, padding);
  297. !         else
  298. !             RevOut(s_hdc, TEXT_X(col), TEXT_Y(row),
  299. !                  foptions, pcliprect, (char *)text, len, padding);
  300. !         }
  301. !         else
  302. ! #endif
  303. !         ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row),
  304. !                  foptions, pcliprect, (char *)text, len, padding);
  305. !     }
  306.       }
  307.   
  308.       if (flags & DRAW_UNDERL)
  309. --- 1714,1796 ----
  310.        * versions.
  311.        * No check for DRAW_BOLD, Windows will have done it already.
  312.        */
  313. ! #ifdef FEAT_MBYTE
  314. !     /* Check if there are any UTF-8 characters.  If not, use normal text
  315. !      * output to speed up output. */
  316. !     if (enc_utf8)
  317. !     for (n = 0; n < len; ++n)
  318. !         if (text[n] >= 0x80)
  319. !         break;
  320. !     /* Check if the Unicode buffer exists and is big enough.  Create it
  321. !      * with the same lengt as the multi-byte string, the number of wide
  322. !      * characters is always equal or smaller. */
  323. !     if ((enc_utf8 || is_funky_dbcs) && (unicodebuf == NULL || len > unibuflen))
  324. !     {
  325. !     vim_free(unicodebuf);
  326. !     unicodebuf = (WCHAR *)alloc(len * sizeof(WCHAR));
  327. !     unibuflen = len;
  328. !     }
  329. !     if (enc_utf8 && n < len && unicodebuf != NULL)
  330. !     {
  331. !     /* Output UTF-8 characters.  Caller has already separated
  332. !      * composing characters. */
  333. !     int        i = 0;
  334. !     int        clen;    /* string length up to composing char */
  335. !     int        cells;    /* cell width of string up to composing char */
  336. !     cells = 0;
  337. !     for (clen = 0; i < len; )
  338. !     {
  339. !         unicodebuf[clen] = utf_ptr2char(text + i);
  340. !         cells += utf_char2cells(unicodebuf[clen]);
  341. !         i += utfc_ptr2len_check_len(text + i, len - i);
  342. !         ++clen;
  343.       }
  344. +     if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT)
  345. +         ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
  346. +                  foptions | ETO_IGNORELANGUAGE,
  347. +                        pcliprect, unicodebuf, clen, NULL);
  348.       else
  349. !         ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
  350. !                  foptions, pcliprect, unicodebuf, clen, NULL);
  351. !     len = cells;    /* used for underlining */
  352. !     }
  353. !     else if (is_funky_dbcs)
  354. !     {
  355. !     /* If we want to display DBCS, and the current CP is not the DBCS
  356. !      * one, we need to go via Unicode. */
  357. !     if (unicodebuf != NULL)
  358. !     {
  359. !         if ((len = MultiByteToWideChar(enc_dbcs,
  360. !             MB_PRECOMPOSED,
  361. !             (char *)text, len,
  362. !             (LPWSTR)unicodebuf, unibuflen)))
  363. !         ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
  364. !                   foptions, pcliprect, unicodebuf, len, NULL);
  365. !     }
  366.       }
  367.       else
  368.   #endif
  369.       {
  370. ! #ifdef FEAT_RIGHTLEFT
  371. !     /* ron: fixed Hebrew on Win98/Win2000 */
  372. !     if (curwin->w_p_rl)
  373.       {
  374.           if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT)
  375. !         ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row),
  376. !              foptions | ETO_IGNORELANGUAGE,
  377. !                    pcliprect, (char *)text, len, padding);
  378.           else
  379. !         RevOut(s_hdc, TEXT_X(col), TEXT_Y(row),
  380. !              foptions, pcliprect, (char *)text, len, padding);
  381.       }
  382.       else
  383.   #endif
  384. !         ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row),
  385. !              foptions, pcliprect, (char *)text, len, padding);
  386.       }
  387.   
  388.       if (flags & DRAW_UNDERL)
  389. *** ../vim61.227/src/gui_w48.c    Sun Oct 13 20:08:14 2002
  390. --- src/gui_w48.c    Tue Oct 15 21:00:25 2002
  391. ***************
  392. *** 190,200 ****
  393.   # define MyTranslateMessage(x) TranslateMessage(x)
  394.   #endif
  395.   
  396. - #ifdef FEAT_MBYTE
  397. - static int sysfixed_width = 0;
  398. - static int sysfixed_height = 0;
  399. - #endif
  400.   extern int current_font_height;        /* this is in os_mswin.c */
  401.   
  402.   static struct
  403. --- 190,195 ----
  404. ***************
  405. *** 2221,2255 ****
  406.       /* we call gui_focus_change() in _OnSetFocus() */
  407.       /* gui_focus_change((int)fActivate); */
  408.       return DefWindowProc(hwnd, WM_ACTIVATEAPP, fActivate, (DWORD)dwThreadId);
  409. - }
  410. -     static BOOL
  411. - _OnCreate(HWND hwnd, LPCREATESTRUCT lpcs)
  412. - {
  413. - #ifdef FEAT_MBYTE
  414. -     /* get system fixed font size*/
  415. -     static const char ach[] = {'W', 'f', 'g', 'M'};
  416. -     HDC        hdc = GetWindowDC(hwnd);
  417. -     HFONT   hfntOld = SelectFont(hdc, GetStockObject(SYSTEM_FIXED_FONT));
  418. -     SIZE    siz;
  419. -     GetTextExtentPoint(hdc, ach, sizeof(ach), &siz);
  420. -     sysfixed_width = siz.cx / sizeof(ach);
  421. -     /*
  422. -      * Make characters one pixel higher (by default), so that italic and bold
  423. -      * fonts don't draw off the bottom of their character space.  Also means
  424. -      * that we can underline an underscore for normal text.
  425. -      */
  426. -     sysfixed_height = siz.cy + p_linespace;
  427. -     SelectFont(hdc, hfntOld);
  428. -     ReleaseDC(hwnd, hdc);
  429. - #endif
  430. -     return 0;
  431.   }
  432.   
  433.   #if defined(FEAT_WINDOWS) || defined(PROTO)
  434. --- 2216,2221 ----
  435. *** ../vim61.227/src/version.c    Mon Oct 14 21:43:21 2002
  436. --- src/version.c    Tue Oct 15 20:56:05 2002
  437. ***************
  438. *** 608,609 ****
  439. --- 608,611 ----
  440.   {   /* Add new patch number below this line */
  441. + /**/
  442. +     228,
  443.   /**/
  444.  
  445. -- 
  446. hundred-and-one symptoms of being an internet addict:
  447. 234. You started college as a chemistry major, and walk out four years
  448.      later as an Internet provider.
  449.  
  450.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  451. ///          Creator of Vim - Vi IMproved -- http://www.vim.org          \\\
  452. \\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
  453.  \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
  454.