2016-03-04 오전 9:09에 SungHyun Nam 이(가) 쓴 글:
> 2016-03-03 오후 7:45에 Bram Moolenaar 이(가) 쓴 글:
>>
>> Patch 7.4.1475
>> Problem:    When using hangulinput with utf-8 a CSI character is
>>             misintepreted.
>> Solution:   Convert CSI to K_CSI. (SungHyun Nam)
>> Files:      src/ui.c
> 
> If a user use euc-kr, then hangul_string_convert() returns NULL.
> So that this patch breaks for such case.
> 
> If you didn't like 'tmpbuf' check in a if statement, that check can
> be safely removed.  I wanted to show the code is safe explicitely.
> I hope you apply my patch as is (or remove the tmpbuf check in
> if()).

Or maybe this patch looks better though we do unneeded alloc/free.

diff --git a/src/hangulin.c b/src/hangulin.c
index d799305..aa0bcce 100644
--- a/src/hangulin.c
+++ b/src/hangulin.c
@@ -1614,6 +1614,10 @@ hangul_string_convert(char_u *buf, int *p_len)
            convert_setup(&vc, NULL, NULL);
        }
     }
+    else
+    {
+       tmpbuf = vim_strsave(buf);
+    }

     return tmpbuf;
 }


BTW, you may want to retab the hangulin.c.  Some lines starts with TAB,
some lines starts with spaces.


>>
>> *** ../vim-7.4.1474/src/ui.c 2016-02-27 18:13:05.240593068 +0100
>> --- src/ui.c 2016-03-03 11:40:32.693060629 +0100
>> ***************
>> *** 1689,1701 ****
>>   
>>       tmpbuf = hangul_string_convert(s, &len);
>>       if (tmpbuf != NULL)
>>      s = tmpbuf;
>>   
>> !     while (len--)
>> !    inbuf[inbufcount++] = *s++;
>> ! 
>> !     if (tmpbuf != NULL)
>>      vim_free(tmpbuf);
>>   }
>>   #endif
>>   
>> --- 1689,1709 ----
>>   
>>       tmpbuf = hangul_string_convert(s, &len);
>>       if (tmpbuf != NULL)
>> +     {
>>      s = tmpbuf;
>>   
>> !    for (; len--; s++)
>> !    {
>> !        inbuf[inbufcount++] = *s;
>> !        if (*s == CSI)
>> !        {
>> !            /* Turn CSI into K_CSI. */
>> !            inbuf[inbufcount++] = KS_EXTRA;
>> !            inbuf[inbufcount++] = (int)KE_CSI;
>> !        }
>> !    }
>>      vim_free(tmpbuf);
>> +     }
>>   }
>>   #endif
>>   
>> *** ../vim-7.4.1474/src/version.c    2016-03-02 22:16:28.512450505 +0100
>> --- src/version.c    2016-03-03 11:41:56.928177531 +0100
>> ***************
>> *** 745,746 ****
>> --- 745,748 ----
>>   {   /* Add new patch number below this line */
>> + /**/
>> +     1475,
>>   /**/
>>
> 

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui