patch 9.1.1574: Dead code in mbyte.c
Problem: Dead code in mbyte.c
Solution: Delete the dead wcwidth()/iswprint() code
(Damien Lejay)
These library calls have been disabled since patch 6.2.446 (2002) due to
display issues with Hebrew. They are also non-portable: wcwidth() is a
POSIX function and not available on MSVC or other non-POSIX platforms.
Keeping this code path adds complexity without benefit.
closes: #17811
Signed-off-by: Damien Lejay <damien@lejay.be>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
1f6faff912
commit
b2013396d4
36
src/mbyte.c
36
src/mbyte.c
@ -120,14 +120,6 @@
|
|||||||
# include <wchar.h>
|
# include <wchar.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
|
||||||
// This has been disabled, because several people reported problems with the
|
|
||||||
// wcwidth() and iswprint() library functions, esp. for Hebrew.
|
|
||||||
# ifdef __STDC_ISO_10646__
|
|
||||||
# define USE_WCHAR_FUNCTIONS
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int dbcs_char2len(int c);
|
static int dbcs_char2len(int c);
|
||||||
static int dbcs_char2bytes(int c, char_u *buf);
|
static int dbcs_char2bytes(int c, char_u *buf);
|
||||||
static int dbcs_ptr2len(char_u *p);
|
static int dbcs_ptr2len(char_u *p);
|
||||||
@ -1593,11 +1585,7 @@ utf_char2cells(int c)
|
|||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
// Use the value from setcellwidths() at 0x80 and higher, unless the
|
// Use the value from setcellwidths() at 0x80 and higher, unless the
|
||||||
// character is not printable.
|
// character is not printable.
|
||||||
if (c >= 0x80 &&
|
if (c >= 0x80 && vim_isprintc(c))
|
||||||
# ifdef USE_WCHAR_FUNCTIONS
|
|
||||||
wcwidth(c) >= 1 &&
|
|
||||||
# endif
|
|
||||||
vim_isprintc(c))
|
|
||||||
{
|
{
|
||||||
int n = cw_value(c);
|
int n = cw_value(c);
|
||||||
if (n != 0)
|
if (n != 0)
|
||||||
@ -1607,25 +1595,10 @@ utf_char2cells(int c)
|
|||||||
|
|
||||||
if (c >= 0x100)
|
if (c >= 0x100)
|
||||||
{
|
{
|
||||||
#ifdef USE_WCHAR_FUNCTIONS
|
|
||||||
int n;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Assume the library function wcwidth() works better than our own
|
|
||||||
* stuff. It should return 1 for ambiguous width chars!
|
|
||||||
*/
|
|
||||||
n = wcwidth(c);
|
|
||||||
|
|
||||||
if (n < 0)
|
|
||||||
return 6; // unprintable, displays <xxxx>
|
|
||||||
if (n > 1)
|
|
||||||
return n;
|
|
||||||
#else
|
|
||||||
if (!utf_printable(c))
|
if (!utf_printable(c))
|
||||||
return 6; // unprintable, displays <xxxx>
|
return 6; // unprintable, displays <xxxx>
|
||||||
if (intable(doublewidth, sizeof(doublewidth), c))
|
if (intable(doublewidth, sizeof(doublewidth), c))
|
||||||
return 2;
|
return 2;
|
||||||
#endif
|
|
||||||
if (p_emoji && intable(emoji_wide, sizeof(emoji_wide), c))
|
if (p_emoji && intable(emoji_wide, sizeof(emoji_wide), c))
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
@ -2712,12 +2685,6 @@ utf_iscomposing(int c)
|
|||||||
int
|
int
|
||||||
utf_printable(int c)
|
utf_printable(int c)
|
||||||
{
|
{
|
||||||
#ifdef USE_WCHAR_FUNCTIONS
|
|
||||||
/*
|
|
||||||
* Assume the iswprint() library function works better than our own stuff.
|
|
||||||
*/
|
|
||||||
return iswprint(c);
|
|
||||||
#else
|
|
||||||
// Sorted list of non-overlapping intervals.
|
// Sorted list of non-overlapping intervals.
|
||||||
// 0xd800-0xdfff is reserved for UTF-16, actually illegal.
|
// 0xd800-0xdfff is reserved for UTF-16, actually illegal.
|
||||||
static struct interval nonprint[] =
|
static struct interval nonprint[] =
|
||||||
@ -2728,7 +2695,6 @@ utf_printable(int c)
|
|||||||
};
|
};
|
||||||
|
|
||||||
return !intable(nonprint, sizeof(nonprint), c);
|
return !intable(nonprint, sizeof(nonprint), c);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sorted list of non-overlapping intervals of all Emoji characters,
|
// Sorted list of non-overlapping intervals of all Emoji characters,
|
||||||
|
|||||||
@ -719,6 +719,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1574,
|
||||||
/**/
|
/**/
|
||||||
1573,
|
1573,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user