forked from aniani/vim
patch 8.1.0806: too many #ifdefs
Problem: Too many #ifdefs. Solution: Graduate FEAT_MBYTE, part 2.
This commit is contained in:
@@ -748,7 +748,7 @@ gui_x11_leave_cb(
|
||||
gui_focus_change(FALSE);
|
||||
}
|
||||
|
||||
#if defined(X_HAVE_UTF8_STRING) && defined(FEAT_MBYTE)
|
||||
#if defined(X_HAVE_UTF8_STRING)
|
||||
# if X_HAVE_UTF8_STRING
|
||||
# define USE_UTF8LOOKUP
|
||||
# endif
|
||||
@@ -810,13 +810,12 @@ gui_x11_key_hit_cb(
|
||||
if (status == XLookupNone || status == XLookupChars)
|
||||
key_sym = XK_VoidSymbol;
|
||||
|
||||
# ifdef FEAT_MBYTE
|
||||
/* Do conversion from 'termencoding' to 'encoding'. When using
|
||||
* Xutf8LookupString() it has already been done. */
|
||||
if (len > 0 && input_conv.vc_type != CONV_NONE
|
||||
# ifdef USE_UTF8LOOKUP
|
||||
# ifdef USE_UTF8LOOKUP
|
||||
&& !enc_utf8
|
||||
# endif
|
||||
# endif
|
||||
)
|
||||
{
|
||||
int maxlen = len * 4 + 40; /* guessed */
|
||||
@@ -829,7 +828,6 @@ gui_x11_key_hit_cb(
|
||||
string_alloced = True;
|
||||
len = convert_input(p, len, maxlen);
|
||||
}
|
||||
# endif
|
||||
|
||||
/* Translate CSI to K_CSI, otherwise it could be recognized as the
|
||||
* start of a special key. */
|
||||
@@ -901,10 +899,7 @@ gui_x11_key_hit_cb(
|
||||
&& (ev_press->state & Mod1Mask)
|
||||
&& !(key_sym == XK_BackSpace || key_sym == XK_Delete)
|
||||
&& (string[0] & 0x80) == 0
|
||||
#ifdef FEAT_MBYTE
|
||||
&& !enc_dbcs
|
||||
#endif
|
||||
)
|
||||
&& !enc_dbcs)
|
||||
{
|
||||
#if defined(FEAT_MENU) && defined(FEAT_GUI_MOTIF)
|
||||
/* Ignore ALT keys when they are used for the menu only */
|
||||
@@ -930,7 +925,6 @@ gui_x11_key_hit_cb(
|
||||
&& !(key_sym == XK_Tab && (ev_press->state & ShiftMask)))
|
||||
{
|
||||
string[0] |= 0x80;
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_utf8) /* convert to utf-8 */
|
||||
{
|
||||
string[1] = string[0] & 0xbf;
|
||||
@@ -944,7 +938,6 @@ gui_x11_key_hit_cb(
|
||||
else
|
||||
len = 2;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
ev_press->state |= Mod1Mask;
|
||||
@@ -983,10 +976,7 @@ gui_x11_key_hit_cb(
|
||||
if (len == -3 || key_sym == XK_space || key_sym == XK_Tab
|
||||
|| key_sym == XK_Return || key_sym == XK_Linefeed
|
||||
|| key_sym == XK_Escape
|
||||
#ifdef FEAT_MBYTE
|
||||
|| (enc_dbcs && len == 1 && (ev_press->state & Mod1Mask))
|
||||
#endif
|
||||
)
|
||||
|| (enc_dbcs && len == 1 && (ev_press->state & Mod1Mask)))
|
||||
{
|
||||
modifiers = 0;
|
||||
if (ev_press->state & ShiftMask)
|
||||
@@ -2375,7 +2365,6 @@ gui_mch_draw_string(
|
||||
int flags)
|
||||
{
|
||||
int cells = len;
|
||||
#ifdef FEAT_MBYTE
|
||||
static void *buf = NULL;
|
||||
static int buflen = 0;
|
||||
char_u *p;
|
||||
@@ -2399,17 +2388,17 @@ gui_mch_draw_string(
|
||||
while (p < s + len)
|
||||
{
|
||||
c = utf_ptr2char(p);
|
||||
# ifdef FEAT_XFONTSET
|
||||
#ifdef FEAT_XFONTSET
|
||||
if (current_fontset != NULL)
|
||||
{
|
||||
# ifdef SMALL_WCHAR_T
|
||||
# ifdef SMALL_WCHAR_T
|
||||
if (c >= 0x10000)
|
||||
c = 0xbf; /* show chars > 0xffff as ? */
|
||||
# endif
|
||||
# endif
|
||||
((wchar_t *)buf)[wlen] = c;
|
||||
}
|
||||
else
|
||||
# endif
|
||||
#endif
|
||||
{
|
||||
if (c >= 0x10000)
|
||||
c = 0xbf; /* show chars > 0xffff as ? */
|
||||
@@ -2431,8 +2420,6 @@ gui_mch_draw_string(
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_XFONTSET
|
||||
if (current_fontset != NULL)
|
||||
{
|
||||
@@ -2452,12 +2439,10 @@ gui_mch_draw_string(
|
||||
|
||||
if (flags & DRAW_TRANSP)
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_utf8)
|
||||
XDrawString16(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col),
|
||||
TEXT_Y(row), buf, wlen);
|
||||
else
|
||||
#endif
|
||||
XDrawString(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col),
|
||||
TEXT_Y(row), (char *)s, len);
|
||||
}
|
||||
@@ -2472,24 +2457,20 @@ gui_mch_draw_string(
|
||||
FILL_Y(row), gui.char_width * cells, gui.char_height);
|
||||
XSetForeground(gui.dpy, gui.text_gc, prev_fg_color);
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_utf8)
|
||||
XDrawString16(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col),
|
||||
TEXT_Y(row), buf, wlen);
|
||||
else
|
||||
#endif
|
||||
XDrawString(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col),
|
||||
TEXT_Y(row), (char *)s, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* XmbDrawImageString has bug, don't use it for fontset. */
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_utf8)
|
||||
XDrawImageString16(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col),
|
||||
TEXT_Y(row), buf, wlen);
|
||||
else
|
||||
#endif
|
||||
XDrawImageString(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col),
|
||||
TEXT_Y(row), (char *)s, len);
|
||||
}
|
||||
@@ -2497,12 +2478,10 @@ gui_mch_draw_string(
|
||||
/* Bold trick: draw the text again with a one-pixel offset. */
|
||||
if (flags & DRAW_BOLD)
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_utf8)
|
||||
XDrawString16(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col) + 1,
|
||||
TEXT_Y(row), buf, wlen);
|
||||
else
|
||||
#endif
|
||||
XDrawString(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col) + 1,
|
||||
TEXT_Y(row), (char *)s, len);
|
||||
}
|
||||
@@ -2628,10 +2607,8 @@ gui_mch_draw_hollow_cursor(guicolor_T color)
|
||||
{
|
||||
int w = 1;
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
if (mb_lefthalve(gui.row, gui.col))
|
||||
w = 2;
|
||||
#endif
|
||||
gui_mch_set_fg_color(color);
|
||||
XDrawRectangle(gui.dpy, gui.wid, gui.text_gc, FILL_X(gui.col),
|
||||
FILL_Y(gui.row), w * gui.char_width - 1, gui.char_height - 1);
|
||||
|
Reference in New Issue
Block a user