SungHyun Nam wrote:

> 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;
>  }

Ah, I thought a NULL return value from hangul_string_convert() meant it
ran out of memory.  So instead we should fall back to the not converted
string.

I don't like assigning to an argument.  It's confusing when debugging.
That's the original reason I changed this.  No need for the alloc/free.

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

I don't see the problem.

-- 
If you had to identify, in one word, the reason why the
human race has not achieved, and never will achieve, its
full potential, that word would be "meetings."

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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