Mercurial > vim
comparison src/hangulin.c @ 7208:2c00f6b312bf v7.4.913
commit https://github.com/vim/vim/commit/72f4cc4a987d123c0ed909c85b9a05f65cef7202
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 10 14:35:18 2015 +0100
patch 7.4.913
Problem: No utf-8 support for the hangul input feature.
Solution: Add utf-8 support. (Namsh)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 10 Nov 2015 14:45:04 +0100 |
parents | 1e621b31948b |
children | 310925215e17 |
comparison
equal
deleted
inserted
replaced
7207:b5b56b0bbd3d | 7208:2c00f6b312bf |
---|---|
1617 *des++ = johab_vow_to_wan[mv]; | 1617 *des++ = johab_vow_to_wan[mv]; |
1618 *des++ = 0xa4; | 1618 *des++ = 0xa4; |
1619 *des++ = johab_lcon_to_wan[lv]; | 1619 *des++ = johab_lcon_to_wan[lv]; |
1620 return 8; | 1620 return 8; |
1621 } | 1621 } |
1622 | |
1623 char_u * | |
1624 hangul_string_convert(buf, p_len) | |
1625 char_u *buf; | |
1626 int *p_len; | |
1627 { | |
1628 char_u *tmpbuf = NULL; | |
1629 vimconv_T vc; | |
1630 | |
1631 if (enc_utf8) | |
1632 { | |
1633 vc.vc_type = CONV_NONE; | |
1634 if (convert_setup(&vc, (char_u *)"euc-kr", p_enc) == OK) | |
1635 { | |
1636 tmpbuf = string_convert(&vc, buf, p_len); | |
1637 convert_setup(&vc, NULL, NULL); | |
1638 } | |
1639 } | |
1640 | |
1641 return tmpbuf; | |
1642 } | |
1643 | |
1644 char_u * | |
1645 hangul_composing_buffer_get(p_len) | |
1646 int *p_len; | |
1647 { | |
1648 char_u *tmpbuf = NULL; | |
1649 | |
1650 if (composing_hangul) | |
1651 { | |
1652 int len = 2; | |
1653 | |
1654 tmpbuf = hangul_string_convert(composing_hangul_buffer, &len); | |
1655 if (tmpbuf != NULL) | |
1656 { | |
1657 *p_len = len; | |
1658 } | |
1659 else | |
1660 { | |
1661 tmpbuf = vim_strnsave(composing_hangul_buffer, 2); | |
1662 *p_len = 2; | |
1663 } | |
1664 } | |
1665 | |
1666 return tmpbuf; | |
1667 } |