Problem: Too many #ifdefs.
Solution: Graduate FEAT_MBYTE, part 2.
#endif
)
{
- head = 0;
for (;;)
{
head = 0;
#if (defined(FEAT_EVAL) && !((defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
&& defined(LC_MESSAGES))) \
|| ((defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
- && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE)) \
&& !defined(LC_MESSAGES))
/*
* Get the language used for messages from the environment.
}
#endif
-#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
- && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
+#if defined(HAVE_LOCALE_H) || defined(X_LOCALE) \
/*
* ":language": Set the language (locale).
*/
xp->xp_pattern = arg;
break;
-#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
- && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
+#if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
case CMD_language:
p = skiptowhite(arg);
if (*p == NUL)
#if defined(FEAT_CMDHIST)
{EXPAND_HISTORY, "history"},
#endif
-#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
- && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
+#if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
{EXPAND_LOCALES, "locale"},
#endif
{EXPAND_MAPCLEAR, "mapclear"},
#ifdef FEAT_PROFILE
{EXPAND_PROFILE, get_profile_name, TRUE, TRUE},
#endif
-#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
- && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
+#if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
{EXPAND_LANGUAGE, get_lang_arg, TRUE, FALSE},
{EXPAND_LOCALES, get_locales, TRUE, FALSE},
#endif
#endif
#if defined(FEAT_DIRECTX)
-# ifndef FEAT_MBYTE
-# error FEAT_MBYTE is required for FEAT_DIRECTX.
-# endif
static DWriteContext *s_dwc = NULL;
static int s_directx_enabled = 0;
static int s_directx_load_attempted = 0;
#ifdef MSWIN_FIND_REPLACE
static UINT s_findrep_msg = 0; /* set in gui_w[16/32].c */
static FINDREPLACE s_findrep_struct;
-# ifdef FEAT_MBYTE
static FINDREPLACEW s_findrep_struct_w;
-# endif
static HWND s_findrep_hwnd = NULL;
static int s_findrep_is_find; /* TRUE for find dialog, FALSE
for find/replace dialog */
}
#endif
-#if defined(FEAT_MBYTE) || defined(GLOBAL_IME)
- /* use of WindowProc depends on wide_WindowProc */
-# define MyWindowProc vim_WindowProc
-#else
- /* use ordinary WindowProc */
-# define MyWindowProc DefWindowProc
-#endif
+/* use of WindowProc depends on wide_WindowProc */
+#define MyWindowProc vim_WindowProc
extern int current_font_height; /* this is in os_mswin.c */
{
int len;
int i;
-#ifdef FEAT_MBYTE
WCHAR wstring[2];
char_u *ws = NULL;
}
if (len == 0)
-#endif
{
string[0] = ch;
len = 1;
#endif
#ifdef MSWIN_FIND_REPLACE
-# ifdef FEAT_MBYTE
/*
* copy useful data from structure LPFINDREPLACE to structure LPFINDREPLACEW
*/
vim_strncpy((char_u *)lpfr->lpstrReplaceWith, p, lpfr->wReplaceWithLen - 1);
vim_free(p);
}
-# endif
/*
* Handle a Find/Replace window message.
int flags = 0;
int down;
-# ifdef FEAT_MBYTE
/* If the OS is Windows NT, and 'encoding' differs from active codepage:
* convert text from wide string. */
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
findrep_wtoa(&s_findrep_struct, &s_findrep_struct_w);
}
-# endif
if (s_findrep_struct.Flags & FR_DIALOGTERM)
/* Give main window the focus back. */
}
}
-#if defined(FEAT_MBYTE) \
- || defined(GLOBAL_IME) \
- || defined(PROTO)
-# ifdef PROTO
+#ifdef PROTO
typedef int WINAPI;
-# endif
+#endif
LRESULT WINAPI
vim_WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
-# ifdef GLOBAL_IME
+#ifdef GLOBAL_IME
return global_ime_DefWindowProc(hwnd, message, wParam, lParam);
-# else
+#else
if (wide_WindowProc)
return DefWindowProcW(hwnd, message, wParam, lParam);
return DefWindowProc(hwnd, message, wParam, lParam);
#endif
}
-#endif
/*
* Called when the foreground or background color has been changed.
rc.left = FILL_X(gui.col);
rc.top = FILL_Y(gui.row);
rc.right = rc.left + gui.char_width;
-#ifdef FEAT_MBYTE
if (mb_lefthalve(gui.row, gui.col))
rc.right += gui.char_width;
-#endif
rc.bottom = rc.top + gui.char_height;
hbr = CreateSolidBrush(color);
FrameRect(s_hdc, &rc, hbr);
return size.cx;
}
-#ifdef FEAT_MBYTE
/*
* Return the width in pixels of the given text in the given DC, taking care
* of 'encoding' to active codepage conversion.
return GetTextWidth(hdc, str, len);
}
-#else
-# define GetTextWidthEnc(h, s, l) GetTextWidth((h), (s), (l))
-#endif
static void get_work_area(RECT *spi_rect);
if (showit)
{
-# ifdef FEAT_MBYTE
-# ifndef TB_SETUNICODEFORMAT
+# ifndef TB_SETUNICODEFORMAT
/* For older compilers. We assume this never changes. */
-# define TB_SETUNICODEFORMAT 0x2005
-# endif
+# define TB_SETUNICODEFORMAT 0x2005
+# endif
/* Enable/disable unicode support */
int uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage);
SendMessage(s_toolbarhwnd, TB_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0);
-# endif
ShowWindow(s_toolbarhwnd, SW_SHOW);
}
else
static void
add_tabline_popup_menu_entry(HMENU pmenu, UINT item_id, char_u *item_text)
{
-#ifdef FEAT_MBYTE
WCHAR *wn = NULL;
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
}
if (wn == NULL)
-#endif
{
MENUITEMINFO info;
int nr = 0;
int curtabidx = 0;
int tabadded = 0;
-#ifdef FEAT_MBYTE
static int use_unicode = FALSE;
int uu;
WCHAR *wstr = NULL;
-#endif
if (s_tabhwnd == NULL)
return;
-#ifdef FEAT_MBYTE
-# ifndef CCM_SETUNICODEFORMAT
+#ifndef CCM_SETUNICODEFORMAT
/* For older compilers. We assume this never changes. */
-# define CCM_SETUNICODEFORMAT 0x2005
-# endif
+# define CCM_SETUNICODEFORMAT 0x2005
+#endif
uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage);
if (uu != use_unicode)
{
SendMessage(s_tabhwnd, CCM_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0);
use_unicode = uu;
}
-#endif
tie.mask = TCIF_TEXT;
tie.iImage = -1;
get_tabline_label(tp, FALSE);
tie.pszText = (LPSTR)NameBuff;
-#ifdef FEAT_MBYTE
wstr = NULL;
if (use_unicode)
{
}
}
if (wstr == NULL)
-#endif
{
TabCtrl_SetItem(s_tabhwnd, nr, &tie);
}
static void
set_window_title(HWND hwnd, char *title)
{
-#ifdef FEAT_MBYTE
if (title != NULL && enc_codepage >= 0 && enc_codepage != (int)GetACP())
{
WCHAR *wbuf;
}
return;
}
-#endif
(void)SetWindowText(hwnd, (LPCSTR)title);
}
if (!IsWindow(s_findrep_hwnd))
{
initialise_findrep(eap->arg);
-# ifdef FEAT_MBYTE
/* If the OS is Windows NT, and 'encoding' differs from active
* codepage: convert text and use wide function. */
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
(LPFINDREPLACEW) &s_findrep_struct_w);
}
else
-# endif
s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct);
}
if (!IsWindow(s_findrep_hwnd))
{
initialise_findrep(eap->arg);
-# ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
findrep_atow(&s_findrep_struct_w, &s_findrep_struct);
(LPFINDREPLACEW) &s_findrep_struct_w);
}
else
-# endif
s_findrep_hwnd = ReplaceText(
(LPFINDREPLACE) &s_findrep_struct);
}
out_flush(); /* make sure all output has been processed */
(void)BeginPaint(hwnd, &ps);
-#ifdef FEAT_MBYTE
/* prevent multi-byte characters from misprinting on an invalid
* rectangle */
if (has_mbyte)
ps.rcPaint.left = rect.left;
ps.rcPaint.right = rect.right;
}
-#endif
if (!IsRectEmpty(&ps.rcPaint))
{
char *font_name = lf.lfFaceName;
charset_name = charset_id2name((int)lf.lfCharSet);
-#ifdef FEAT_MBYTE
/* Convert a font name from the current codepage to 'encoding'.
* TODO: Use Wide APIs (including LOGFONTW) instead of ANSI APIs. */
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
acp_to_enc((char_u *)lf.lfFaceName, (int)strlen(lf.lfFaceName),
(char_u **)&font_name, &len);
}
-#endif
quality_name = quality_id2name((int)lf.lfQuality);
res = (char *)alloc((unsigned)(strlen(font_name) + 20
}
}
-#ifdef FEAT_MBYTE
if (font_name != lf.lfFaceName)
vim_free(font_name);
-#endif
return (char_u *)res;
}
}
#endif
-#ifdef FEAT_MBYTE
/*
* Handler of gui.wide_font (p_guifontwide) changed notification.
*/
{
LOGFONT lf;
-# ifdef FEAT_MBYTE_IME
+#ifdef FEAT_MBYTE_IME
update_im_font();
-# endif
+#endif
gui_mch_free_font(gui.wide_ital_font);
gui.wide_ital_font = NOFONT;
}
}
}
-#endif
/*
* Initialise vim to use the font with the given name.
#endif
#if defined(FEAT_BROWSE) || defined(PROTO)
-/*
- * The file browser exists in two versions: with "W" uses wide characters,
- * without "W" the current codepage. When FEAT_MBYTE is defined and on
- * Windows NT/2000/XP the "W" functions are used.
- */
-
-# ifdef FEAT_MBYTE
/*
* Wide version of convert_filter().
*/
}
/*
- * Wide version of gui_mch_browse(). Keep in sync!
+ * Pop open a file browser and return the file selected, in allocated memory,
+ * or NULL if Cancel is hit.
+ * saving - TRUE if the file will be saved to, FALSE if it will be opened.
+ * title - Title message for the file browser dialog.
+ * dflt - Default name of file.
+ * ext - Default extension to be added to files without extensions.
+ * initdir - directory in which to open the browser (NULL = current dir)
+ * filter - Filter for matched files to choose from.
*/
static char_u *
-gui_mch_browseW(
+gui_mch_browse(
int saving,
char_u *title,
char_u *dflt,
vim_free(p);
return q;
}
-# endif /* FEAT_MBYTE */
/*
return gui_mch_browse(0, title, (char_u *)_("Not Used"), NULL,
initdir, (char_u *)_("Directory\t*.nothing\n"));
}
-
-/*
- * Pop open a file browser and return the file selected, in allocated memory,
- * or NULL if Cancel is hit.
- * saving - TRUE if the file will be saved to, FALSE if it will be opened.
- * title - Title message for the file browser dialog.
- * dflt - Default name of file.
- * ext - Default extension to be added to files without extensions.
- * initdir - directory in which to open the browser (NULL = current dir)
- * filter - Filter for matched files to choose from.
- *
- * Keep in sync with gui_mch_browseW() above!
- */
- char_u *
-gui_mch_browse(
- int saving,
- char_u *title,
- char_u *dflt,
- char_u *ext,
- char_u *initdir,
- char_u *filter)
-{
-# ifdef FEAT_MBYTE
- return gui_mch_browseW(saving, title, dflt, ext, initdir, filter);
-# else
- OPENFILENAME fileStruct;
- char_u fileBuf[MAXPATHL];
- char_u *initdirp = NULL;
- char_u *filterp;
- char_u *p;
-
- if (dflt == NULL)
- fileBuf[0] = NUL;
- else
- vim_strncpy(fileBuf, dflt, MAXPATHL - 1);
-
- /* Convert the filter to Windows format. */
- filterp = convert_filter(filter);
-
- vim_memset(&fileStruct, 0, sizeof(OPENFILENAME));
-# ifdef OPENFILENAME_SIZE_VERSION_400
- /* be compatible with Windows NT 4.0 */
- fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400;
-# else
- fileStruct.lStructSize = sizeof(fileStruct);
-# endif
-
- fileStruct.lpstrTitle = (LPSTR)title;
- fileStruct.lpstrDefExt = (LPSTR)ext;
-
- fileStruct.lpstrFile = (LPSTR)fileBuf;
- fileStruct.nMaxFile = MAXPATHL;
- fileStruct.lpstrFilter = (LPSTR)filterp;
- fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/
- /* has an initial dir been specified? */
- if (initdir != NULL && *initdir != NUL)
- {
- /* Must have backslashes here, no matter what 'shellslash' says */
- initdirp = vim_strsave(initdir);
- if (initdirp != NULL)
- for (p = initdirp; *p != NUL; ++p)
- if (*p == '/')
- *p = '\\';
- fileStruct.lpstrInitialDir = (LPSTR)initdirp;
- }
-
- /*
- * TODO: Allow selection of multiple files. Needs another arg to this
- * function to ask for it, and need to use OFN_ALLOWMULTISELECT below.
- * Also, should we use OFN_FILEMUSTEXIST when opening? Vim can edit on
- * files that don't exist yet, so I haven't put it in. What about
- * OFN_PATHMUSTEXIST?
- * Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog.
- */
- fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY);
-# ifdef FEAT_SHORTCUT
- if (curbuf->b_p_bin)
- fileStruct.Flags |= OFN_NODEREFERENCELINKS;
-# endif
- if (saving)
- {
- if (!GetSaveFileName(&fileStruct))
- return NULL;
- }
- else
- {
- if (!GetOpenFileName(&fileStruct))
- return NULL;
- }
-
- vim_free(filterp);
- vim_free(initdirp);
-
- /* Give focus back to main window (when using MDI). */
- SetFocus(s_hwnd);
-
- /* Shorten the file name if possible */
- return vim_strsave(shorten_fname1((char_u *)fileBuf));
-# endif
-}
#endif /* FEAT_BROWSE */
static void
{
#define BUFPATHLEN _MAX_PATH
#define DRAGQVAL 0xFFFFFFFF
-#ifdef FEAT_MBYTE
WCHAR wszFile[BUFPATHLEN];
-#endif
char szFile[BUFPATHLEN];
UINT cFiles = DragQueryFile(hDrop, DRAGQVAL, NULL, 0);
UINT i;
if (fnames != NULL)
for (i = 0; i < cFiles; ++i)
{
-#ifdef FEAT_MBYTE
if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0)
fnames[i] = utf16_to_enc(wszFile, NULL);
else
-#endif
{
DragQueryFile(hDrop, i, szFile, BUFPATHLEN);
fnames[i] = vim_strsave((char_u *)szFile);
*tofree = NULL;
-#ifdef FEAT_MBYTE
/* Try using the Unicode version first, it takes care of conversion when
* 'encoding' is changed. */
argc = get_cmd_argsW(&argv);
if (argc != 0)
goto done;
-#endif
/* Handle the program name. Remove the ".exe" extension, and find the 1st
* non-space. */
{
if (pnew != NULL)
*pnew++ = *p;
-#ifdef FEAT_MBYTE
/* Can't use mb_* functions, because 'encoding' is not
* initialized yet here. */
if (IsDBCSLeadByte(*p))
if (pnew != NULL)
*pnew++ = *p;
}
-#endif
++p;
}
}
}
}
-#ifdef FEAT_MBYTE
done:
-#endif
argv[argc] = NULL; /* NULL-terminated list */
*argvp = argv;
return argc;
LPARAM lParam;
} NMTTDISPINFO_NEW;
-#ifdef FEAT_MBYTE
typedef struct tagTOOLINFOW_NEW
{
UINT cbSize;
LPARAM lParam;
} NMTTDISPINFOW_NEW;
-#endif
typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *);
#ifndef TTM_SETMAXTIPWIDTH
} NMTTDISPINFOA, *LPNMTTDISPINFOA;
# define LPNMTTDISPINFO LPNMTTDISPINFOA
-# ifdef FEAT_MBYTE
typedef struct tagNMTTDISPINFOW {
NMHDR hdr;
LPWSTR lpszText;
UINT uFlags;
LPARAM lParam;
} NMTTDISPINFOW, *LPNMTTDISPINFOW;
-# endif
# endif
#endif
case WM_NOTIFY:
switch (((LPNMHDR) lParam)->code)
{
-# ifdef FEAT_MBYTE
case TTN_GETDISPINFOW:
-# endif
case TTN_GETDISPINFO:
{
LPNMHDR hdr = (LPNMHDR)lParam;
# endif
if (str != NULL)
{
-# ifdef FEAT_MBYTE
if (hdr->code == TTN_GETDISPINFOW)
{
LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)lParam;
/* can't show tooltip if failed */
}
else
-# endif
{
LPNMTTDISPINFO lpdi = (LPNMTTDISPINFO)lParam;
const char szVimWndClass[] = VIM_CLASS;
const char szTextAreaClass[] = "VimTextArea";
WNDCLASS wndclass;
-#ifdef FEAT_MBYTE
const WCHAR szVimWndClassW[] = VIM_CLASSW;
const WCHAR szTextAreaClassW[] = L"VimTextArea";
WNDCLASSW wndclassw;
-#endif
#ifdef GLOBAL_IME
ATOM atom;
#endif
s_brush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
-#ifdef FEAT_MBYTE
/* First try using the wide version, so that we can use any title.
* Otherwise only characters in the active codepage will work. */
if (GetClassInfoW(s_hinst, szVimWndClassW, &wndclassw) == 0)
}
if (!wide_WindowProc)
-#endif
-
- if (GetClassInfo(s_hinst, szVimWndClass, &wndclass) == 0)
- {
- wndclass.style = CS_DBLCLKS;
- wndclass.lpfnWndProc = _WndProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = s_hinst;
- wndclass.hIcon = LoadIcon(wndclass.hInstance, "IDR_VIM");
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = s_brush;
- wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName = szVimWndClass;
-
- if ((
+ if (GetClassInfo(s_hinst, szVimWndClass, &wndclass) == 0)
+ {
+ wndclass.style = CS_DBLCLKS;
+ wndclass.lpfnWndProc = _WndProc;
+ wndclass.cbClsExtra = 0;
+ wndclass.cbWndExtra = 0;
+ wndclass.hInstance = s_hinst;
+ wndclass.hIcon = LoadIcon(wndclass.hInstance, "IDR_VIM");
+ wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hbrBackground = s_brush;
+ wndclass.lpszMenuName = NULL;
+ wndclass.lpszClassName = szVimWndClass;
+
+ if ((
#ifdef GLOBAL_IME
- atom =
+ atom =
#endif
- RegisterClass(&wndclass)) == 0)
- return FAIL;
- }
+ RegisterClass(&wndclass)) == 0)
+ return FAIL;
+ }
if (vim_parent_hwnd != NULL)
{
#endif
/* Create the text area window */
-#ifdef FEAT_MBYTE
if (wide_WindowProc)
{
if (GetClassInfoW(s_hinst, szTextAreaClassW, &wndclassw) == 0)
s_hwnd, NULL,
s_hinst, NULL);
}
- else
-#endif
- if (GetClassInfo(s_hinst, szTextAreaClass, &wndclass) == 0)
+ else if (GetClassInfo(s_hinst, szTextAreaClass, &wndclass) == 0)
{
wndclass.style = CS_OWNDC;
wndclass.lpfnWndProc = _TextAreaWndProc;
s_findrep_struct.lpstrReplaceWith[0] = NUL;
s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE;
s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE;
-# ifdef FEAT_MBYTE
s_findrep_struct_w.lStructSize = sizeof(s_findrep_struct_w);
s_findrep_struct_w.lpstrFindWhat =
(LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR));
s_findrep_struct_w.lpstrReplaceWith[0] = NUL;
s_findrep_struct_w.wFindWhatLen = MSWIN_FR_BUFSIZE;
s_findrep_struct_w.wReplaceWithLen = MSWIN_FR_BUFSIZE;
-# endif
#endif
#ifdef FEAT_EVAL
#endif /* FEAT_MBYTE_IME */
-#if defined(FEAT_MBYTE) && !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME)
+#if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME)
/* Win32 with GLOBAL IME */
/*
}
#endif
-#ifdef FEAT_MBYTE
/*
* Convert latin9 text "text[len]" to ucs-2 in "unicodebuf".
*/
*unicodebuf++ = c;
}
}
-#endif
#ifdef FEAT_RIGHTLEFT
/*
int i;
const RECT *pcliprect = NULL;
UINT foptions = 0;
-#ifdef FEAT_MBYTE
static WCHAR *unicodebuf = NULL;
static int *unicodepdy = NULL;
static int unibuflen = 0;
int n = 0;
-#endif
int y;
/*
*/
rc.left = FILL_X(col);
rc.top = FILL_Y(row);
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
/* Compute the length in display cells. */
rc.right = FILL_X(col + mb_string2cells(text, len));
}
else
-#endif
rc.right = FILL_X(col + len);
rc.bottom = FILL_Y(row + 1);
* No check for DRAW_BOLD, Windows will have done it already.
*/
-#ifdef FEAT_MBYTE
/* Check if there are any UTF-8 characters. If not, use normal text
* output to speed up output. */
if (enc_utf8)
if (text[n] >= 0x80)
break;
-# if defined(FEAT_DIRECTX)
+#if defined(FEAT_DIRECTX)
/* Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is
* required that unicode drawing routine, currently. So this forces it
* enabled. */
if (IS_ENABLE_DIRECTX())
n = 0; /* Keep n < len, to enter block for unicode. */
-# endif
+#endif
/* Check if the Unicode buffer exists and is big enough. Create it
* with the same length as the multi-byte string, the number of wide
i += utf_ptr2len_len(text + i, len - i);
++clen;
}
-# if defined(FEAT_DIRECTX)
+#if defined(FEAT_DIRECTX)
if (IS_ENABLE_DIRECTX())
{
/* Add one to "cells" for italics. */
foptions, pcliprect, unicodepdy);
}
else
-# endif
+#endif
ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
foptions, pcliprect, unicodebuf, wlen, unicodepdy);
len = cells; /* used for underlining */
}
}
else
-#endif
{
#ifdef FEAT_RIGHTLEFT
/* Windows will mess up RL text, so we have to draw it character by
if (menu_is_menubar(menu->name))
{
-#ifdef FEAT_MBYTE
WCHAR *wn = NULL;
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
}
if (wn == NULL)
-#endif
{
MENUITEMINFO info;
else
#endif
{
-#ifdef FEAT_MBYTE
WCHAR *wn = NULL;
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
}
}
if (wn == NULL)
-#endif
InsertMenu(parent->submenu_id, (UINT)idx,
(menu_is_separator(menu->name) ? MF_SEPARATOR : MF_STRING)
| MF_BYPOSITION,
/* If the edit box exists, copy the string. */
if (s_textfield != NULL)
{
-# ifdef FEAT_MBYTE
/* If the OS is Windows NT, and 'encoding' differs from active
* codepage: use wide function and convert text. */
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
vim_free(wp);
}
else
-# endif
GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2,
(LPSTR)s_textfield, IOSIZE);
}
last_white = NULL;
for (pend = pstart; *pend != NUL && *pend != '\n'; )
{
-#ifdef FEAT_MBYTE
l = (*mb_ptr2len)(pend);
-#else
- l = 1;
-#endif
if (l == 1 && VIM_ISWHITE(*pend)
&& textWidth > maxDialogWidth * 3 / 4)
last_white = pend;
BOOL use_enc)
{
int nChar = 0;
-#ifdef FEAT_MBYTE
int len = lstrlen(lpAnsiIn) + 1; /* include NUL character */
int i;
WCHAR *wn;
for (i = 0; i < nChar; ++i)
if (lpWCStr[i] == (WORD)'\t') /* replace tabs with spaces */
lpWCStr[i] = (WORD)' ';
-#else
- do
- {
- if (*lpAnsiIn == '\t')
- *lpWCStr++ = (WORD)' ';
- else
- *lpWCStr++ = (WORD)*lpAnsiIn;
- nChar++;
- } while (*lpAnsiIn++);
-#endif
return nChar;
}
return multiline_tip;
}
-#ifdef FEAT_MBYTE
static void
make_tooltipw(BalloonEval *beval, char *text, POINT pt)
{
mouse_event(MOUSEEVENTF_MOVE, (DWORD)-1, (DWORD)-1, 0, 0);
vim_free(pti);
}
-#endif
static void
make_tooltip(BalloonEval *beval, char *text, POINT pt)
TOOLINFO *pti;
int ToolInfoSize;
-#ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
make_tooltipw(beval, text, pt);
return;
}
-#endif
if (multiline_balloon_available() == TRUE)
ToolInfoSize = sizeof(TOOLINFO_NEW);
info->uFlags |= TTF_DI_SETITEM;
}
break;
-#ifdef FEAT_MBYTE
case TTN_GETDISPINFOW:
{
// if we get here then we have new common controls
info->uFlags |= TTF_DI_SETITEM;
}
break;
-#endif
}
}
}
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
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 */
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. */
&& (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 */
&& !(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;
else
len = 2;
}
-#endif
}
else
ev_press->state |= Mod1Mask;
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)
int flags)
{
int cells = len;
-#ifdef FEAT_MBYTE
static void *buf = NULL;
static int buflen = 0;
char_u *p;
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 ? */
}
}
-#endif
-
#ifdef FEAT_XFONTSET
if (current_fontset != NULL)
{
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);
}
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);
}
/* 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);
}
{
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);
static long_u curr_fg;
static int page_count;
-#if defined(FEAT_MBYTE) && defined(FEAT_POSTSCRIPT)
+#if defined(FEAT_POSTSCRIPT)
# define OPT_MBFONT_USECOURIER 0
# define OPT_MBFONT_ASCII 1
# define OPT_MBFONT_REGULAR 2
return parse_list_options(p_popt, printer_opts, OPT_PRINT_NUM_OPTIONS);
}
-#if (defined(FEAT_MBYTE) && defined(FEAT_POSTSCRIPT)) || defined(PROTO)
+#if defined(FEAT_POSTSCRIPT) || defined(PROTO)
/*
* Parse 'printmbfont' and set the flags in "mbfont_opts".
* Returns an error message or NULL;
int page_line;
char_u *tbuf;
char_u *p;
-#ifdef FEAT_MBYTE
int l;
-#endif
/* Also use the space for the line number. */
if (prt_use_number())
mch_print_start_line(TRUE, page_line);
for (p = tbuf; *p != NUL; )
{
- if (mch_print_text_out(p,
-#ifdef FEAT_MBYTE
- (l = (*mb_ptr2len)(p))
-#else
- 1
-#endif
- ))
+ if (mch_print_text_out(p, (l = (*mb_ptr2len)(p))))
{
++page_line;
if (page_line >= 0) /* out of room in header */
break;
mch_print_start_line(TRUE, page_line);
}
-#ifdef FEAT_MBYTE
p += l;
-#else
- p++;
-#endif
}
vim_free(tbuf);
for (col = ppos->column; line[col] != NUL && !need_break; col += outputlen)
{
outputlen = 1;
-#ifdef FEAT_MBYTE
if (has_mbyte && (outputlen = (*mb_ptr2len)(line + col)) < 1)
outputlen = 1;
-#endif
#ifdef FEAT_SYN_HL
/*
* syntax highlighting stuff.
else
{
need_break = mch_print_text_out(line + col, outputlen);
-#ifdef FEAT_MBYTE
if (has_mbyte)
print_pos += (*mb_ptr2cells)(line + col);
else
-#endif
print_pos++;
}
}
{"Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique"}
};
-#ifdef FEAT_MBYTE
/* Generic font metrics for multi-byte fonts */
static struct prt_ps_font_S prt_ps_mb_font =
{
-250, 805,
{NULL, NULL, NULL, NULL}
};
-#endif
/* Pointer to current font set being used */
static struct prt_ps_font_S* prt_ps_font;
int has_charset;
};
-#ifdef FEAT_MBYTE
#define CS_JIS_C_1978 (0x01)
#define CS_JIS_X_1983 (0x02)
"KS_X_1992"
}
};
-#endif /* FEAT_MBYTE */
struct prt_ps_resource_S
{
static char_u prt_line_buffer[257];
static garray_T prt_ps_buffer;
-# ifdef FEAT_MBYTE
static int prt_do_conv;
static vimconv_T prt_conv;
static int prt_half_width;
static char *prt_ascii_encoding;
static char_u prt_hexchar[] = "0123456789abcdef";
-# endif
static void
prt_write_file_raw_len(char_u *buffer, int bytes)
vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer),
"/_%s /VIM-%s /%s ref\n", new_name, encoding, font);
prt_write_file(prt_line_buffer);
-#ifdef FEAT_MBYTE
if (prt_out_mbyte)
sprintf((char *)prt_line_buffer, "/%s %d %f /_%s sffs\n",
new_name, height, 500./prt_ps_courier_font.wx, new_name);
else
-#endif
vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer),
"/%s %d /_%s ffs\n", new_name, height, new_name);
prt_write_file(prt_line_buffer);
}
-#ifdef FEAT_MBYTE
/*
* Write a line to define the CID font.
*/
"/%s %s d\n", new_name, original_name);
prt_write_file(prt_line_buffer);
}
-#endif
/*
* Convert a real value into an integer and fractional part as integers, with
/* Draw the text
* Note: we write text out raw - EBCDIC conversion is handled in the
* PostScript world via the font encoding vector. */
-#ifdef FEAT_MBYTE
if (prt_out_mbyte)
prt_write_string("<");
else
-#endif
prt_write_string("(");
prt_write_file_raw_len(prt_ps_buffer.ga_data, prt_ps_buffer.ga_len);
-#ifdef FEAT_MBYTE
if (prt_out_mbyte)
prt_write_string(">");
else
-#endif
prt_write_string(")");
/* Add a moveto if need be and use the appropriate show procedure */
if (prt_do_moveto)
void
mch_print_cleanup(void)
{
-#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
int i;
convert_setup(&prt_conv, NULL, NULL);
prt_do_conv = FALSE;
}
-#endif
if (prt_ps_fd != NULL)
{
fclose(prt_ps_fd);
if (prt_use_number())
{
prt_number_width = PRINT_NUMBER_WIDTH * prt_char_width;
-#ifdef FEAT_MBYTE
/* If we are outputting multi-byte characters then line numbers will be
* printed with half width characters
*/
if (prt_out_mbyte)
prt_number_width /= 2;
-#endif
prt_left_margin += prt_number_width;
}
else
return (int)((prt_right_margin - prt_left_margin) / prt_char_width);
}
-#ifdef FEAT_MBYTE
static int
prt_build_cid_fontname(int font, char_u *name, int name_len)
{
return TRUE;
}
-#endif
/*
* Get number of lines of text that fit on a page (excluding the header).
return lpp - prt_header_height();
}
-#ifdef FEAT_MBYTE
static int
prt_match_encoding(
char *p_encoding,
}
return FALSE;
}
-#endif
int
mch_print_init(
double right;
double top;
double bottom;
-#ifdef FEAT_MBYTE
int props;
int cmap = 0;
char_u *p_encoding;
struct prt_ps_encoding_S *p_mbenc;
struct prt_ps_encoding_S *p_mbenc_first;
struct prt_ps_charset_S *p_mbchar = NULL;
-#endif
#if 0
/*
/*
* Set up font and encoding.
*/
-#ifdef FEAT_MBYTE
p_encoding = enc_skip(p_penc);
if (*p_encoding == NUL)
p_encoding = enc_skip(p_enc);
prt_ps_font = &prt_ps_mb_font;
}
else
-#endif
{
-#ifdef FEAT_MBYTE
prt_use_courier = FALSE;
-#endif
prt_ps_font = &prt_ps_courier_font;
}
}
prt_bufsiz = psettings->chars_per_line;
-#ifdef FEAT_MBYTE
if (prt_out_mbyte)
prt_bufsiz *= 2;
-#endif
ga_init2(&prt_ps_buffer, (int)sizeof(char), prt_bufsiz);
prt_page_num = 0;
char buffer[256];
char_u *p_encoding;
char_u *p;
-#ifdef FEAT_MBYTE
struct prt_ps_resource_S *res_cidfont;
struct prt_ps_resource_S *res_cmap;
-#endif
int retval = FALSE;
res_prolog = (struct prt_ps_resource_S *)
alloc(sizeof(struct prt_ps_resource_S));
res_encoding = (struct prt_ps_resource_S *)
alloc(sizeof(struct prt_ps_resource_S));
-#ifdef FEAT_MBYTE
res_cidfont = (struct prt_ps_resource_S *)
alloc(sizeof(struct prt_ps_resource_S));
res_cmap = (struct prt_ps_resource_S *)
alloc(sizeof(struct prt_ps_resource_S));
-#endif
if (res_prolog == NULL || res_encoding == NULL
-#ifdef FEAT_MBYTE
- || res_cidfont == NULL || res_cmap == NULL
-#endif
- )
+ || res_cidfont == NULL || res_cmap == NULL)
goto theend;
/*
prt_mediasize[prt_media].height,
(double)0, NULL, NULL);
/* Define fonts needed */
-#ifdef FEAT_MBYTE
if (!prt_out_mbyte || prt_use_courier)
-#endif
prt_dsc_font_resource("DocumentNeededResources", &prt_ps_courier_font);
-#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
prt_dsc_font_resource((prt_use_courier ? NULL
if (!prt_custom_cmap)
prt_dsc_resources(NULL, "cmap", prt_cmap);
}
-#endif
/* Search for external resources VIM supplies */
if (!prt_find_resource("prolog", res_prolog))
goto theend;
if (!prt_check_resource(res_prolog, PRT_PROLOG_VERSION))
goto theend;
-#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
/* Look for required version of multi-byte printing procset */
if (!prt_check_resource(res_cidfont, PRT_CID_PROLOG_VERSION))
goto theend;
}
-#endif
/* Find an encoding to use for printing.
* Check 'printencoding'. If not set or not found, then use 'encoding'. If
* that cannot be found then default to "latin1".
* Note: VIM specific encoding header is always skipped.
*/
-#ifdef FEAT_MBYTE
if (!prt_out_mbyte)
{
-#endif
p_encoding = enc_skip(p_penc);
if (*p_encoding == NUL
|| !prt_find_resource((char *)p_encoding, res_encoding))
{
/* 'printencoding' not set or not supported - find alternate */
-#ifdef FEAT_MBYTE
int props;
p_encoding = enc_skip(p_enc);
if (!(props & ENC_8BIT)
|| !prt_find_resource((char *)p_encoding, res_encoding))
/* 8-bit 'encoding' is not supported */
-#endif
{
/* Use latin1 as default printing encoding */
p_encoding = (char_u *)"latin1";
goto theend;
/* For the moment there are no checks on encoding resource files to
* perform */
-#ifdef FEAT_MBYTE
}
else
{
if (!prt_open_resource(res_cmap))
goto theend;
}
-#endif
/* List resources supplied */
STRCPY(buffer, res_prolog->title);
STRCAT(buffer, " ");
STRCAT(buffer, res_prolog->version);
prt_dsc_resources("DocumentSuppliedResources", "procset", buffer);
-#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
STRCPY(buffer, res_cidfont->title);
}
}
if (!prt_out_mbyte || prt_use_courier)
-#endif
{
STRCPY(buffer, res_encoding->title);
STRCAT(buffer, " ");
prt_dsc_noarg("BeginDefaults");
/* List font resources most likely common to all pages */
-#ifdef FEAT_MBYTE
if (!prt_out_mbyte || prt_use_courier)
-#endif
prt_dsc_font_resource("PageResources", &prt_ps_courier_font);
-#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
prt_dsc_font_resource((prt_use_courier ? NULL : "PageResources"),
if (!prt_custom_cmap)
prt_dsc_resources(NULL, "cmap", prt_cmap);
}
-#endif
/* Paper will be used for all pages */
prt_dsc_textline("PageMedia", prt_mediasize[prt_media].name);
/* Add required procsets - NOTE: order is important! */
if (!prt_add_resource(res_prolog))
goto theend;
-#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
/* Add CID font procset, and any user supplied CMap */
if (prt_custom_cmap && !prt_add_resource(res_cmap))
goto theend;
}
-#endif
-#ifdef FEAT_MBYTE
if (!prt_out_mbyte || prt_use_courier)
-#endif
/* There will be only one Roman font encoding to be included in the PS
* file. */
if (!prt_add_resource(res_encoding))
prt_write_string("c\n");
/* Font resource inclusion and definition */
-#ifdef FEAT_MBYTE
if (!prt_out_mbyte || prt_use_courier)
{
/* When using Courier for ASCII range when printing multi-byte, need to
* pick up ASCII encoding to use with it. */
if (prt_use_courier)
p_encoding = (char_u *)prt_ascii_encoding;
-#endif
prt_dsc_resources("IncludeResource", "font",
prt_ps_courier_font.ps_fontname[PRT_PS_FONT_ROMAN]);
prt_def_font("F0", (char *)p_encoding, (int)prt_line_height,
prt_ps_courier_font.ps_fontname[PRT_PS_FONT_BOLDOBLIQUE]);
prt_def_font("F3", (char *)p_encoding, (int)prt_line_height,
prt_ps_courier_font.ps_fontname[PRT_PS_FONT_BOLDOBLIQUE]);
-#ifdef FEAT_MBYTE
}
if (prt_out_mbyte)
{
/* Use BOLD for BOLDOBLIQUE */
prt_dup_cidfont("CF1", "CF3");
}
-#endif
/* Misc constant vars used for underlining and background rects */
prt_def_var("UO", PRT_PS_FONT_TO_USER(prt_line_height,
theend:
vim_free(res_prolog);
vim_free(res_encoding);
-#ifdef FEAT_MBYTE
vim_free(res_cidfont);
vim_free(res_cmap);
-#endif
return retval;
}
prt_dsc_noarg("BeginPageSetup");
prt_write_string("sv\n0 g\n");
-#ifdef FEAT_MBYTE
prt_in_ascii = !prt_out_mbyte;
if (prt_out_mbyte)
prt_write_string("CF0 sf\n");
else
-#endif
prt_write_string("F0 sf\n");
prt_fgcol = PRCOLOR_BLACK;
prt_bgcol = PRCOLOR_WHITE;
prt_attribute_change = TRUE;
prt_need_moveto = TRUE;
-#ifdef FEAT_MBYTE
prt_half_width = FALSE;
-#endif
}
int
char_u ch_buff[8];
float char_width;
float next_pos;
-#ifdef FEAT_MBYTE
int in_ascii;
int half_width;
char_u *tofree = NULL;
-#endif
char_width = prt_char_width;
-#ifdef FEAT_MBYTE
/* Ideally VIM would create a rearranged CID font to combine a Roman and
* CJKV font to do what VIM is doing here - use a Roman font for characters
* in the ASCII range, and the original CID font for everything else.
prt_attribute_change = TRUE;
}
}
-#endif
/* Output any required changes to the graphics state, after flushing any
* text buffered so far.
}
if (prt_need_font)
{
-#ifdef FEAT_MBYTE
if (!prt_in_ascii)
prt_write_string("CF");
else
-#endif
prt_write_string("F");
prt_write_int(prt_font);
prt_write_string("sf\n");
prt_attribute_change = FALSE;
}
-#ifdef FEAT_MBYTE
if (prt_do_conv)
{
/* Convert from multi-byte to 8-bit encoding */
}
}
else
-#endif
{
/* Add next character to buffer of characters to output.
* Note: One printed character may require several PS characters to
ga_append(&prt_ps_buffer, ch);
}
-#ifdef FEAT_MBYTE
/* Need to free any translated characters */
vim_free(tofree);
-#endif
prt_text_run += char_width;
prt_pos_x += char_width;
* comm window in the communication window.
* Length must be computed exactly!
*/
-#ifdef FEAT_MBYTE
length = STRLEN(name) + STRLEN(p_enc) + STRLEN(cmd) + 14;
-#else
- length = STRLEN(name) + STRLEN(cmd) + 10;
-#endif
property = (char_u *)alloc((unsigned)length + 30);
-#ifdef FEAT_MBYTE
sprintf((char *)property, "%c%c%c-n %s%c-E %s%c-s %s",
0, asExpr ? 'c' : 'k', 0, name, 0, p_enc, 0, cmd);
-#else
- sprintf((char *)property, "%c%c%c-n %s%c-s %s",
- 0, asExpr ? 'c' : 'k', 0, name, 0, cmd);
-#endif
if (name == loosename)
vim_free(loosename);
/* Add a back reference to our comm window */
if (!WindowValid(dpy, win))
return -1;
-#ifdef FEAT_MBYTE
length = STRLEN(p_enc) + STRLEN(str) + 14;
-#else
- length = STRLEN(str) + 10;
-#endif
if ((property = (char_u *)alloc((unsigned)length + 30)) != NULL)
{
-#ifdef FEAT_MBYTE
sprintf((char *)property, "%cn%c-E %s%c-n %s%c-w %x",
0, 0, p_enc, 0, str, 0, (unsigned int)commWindow);
-#else
- sprintf((char *)property, "%cn%c-n %s%c-w %x",
- 0, 0, str, 0, (unsigned int)commWindow);
-#endif
/* Add length of what "%x" resulted in. */
length += STRLEN(property + length);
res = AppendPropCarefully(dpy, win, commProperty, property, length + 1);
/* Initialize the result property. */
ga_init2(&reply, 1, 100);
-#ifdef FEAT_MBYTE
(void)ga_grow(&reply, 50 + STRLEN(p_enc));
sprintf(reply.ga_data, "%cr%c-E %s%c-s %s%c-r ",
0, 0, p_enc, 0, serial, 0);
reply.ga_len = 14 + STRLEN(p_enc) + STRLEN(serial);
-#else
- (void)ga_grow(&reply, 50);
- sprintf(reply.ga_data, "%cr%c-s %s%c-r ",
- 0, 0, serial, 0);
- reply.ga_len = 10 + STRLEN(serial);
-#endif
/* Evaluate the expression and return the result. */
if (res != NULL)
ga_concat(gap, (char_u *)"\"\"");
else
{
-#if defined(FEAT_MBYTE) && defined(USE_ICONV)
+#if defined(USE_ICONV)
vimconv_T conv;
char_u *converted = NULL;
while (*res != NUL)
{
int c;
-#ifdef FEAT_MBYTE
/* always use utf-8 encoding, ignore 'encoding' */
c = utf_ptr2char(res);
-#else
- c = *res;
-#endif
switch (c)
{
default:
if (c >= 0x20)
{
-#ifdef FEAT_MBYTE
numbuf[utf_char2bytes(c, numbuf)] = NUL;
-#else
- numbuf[0] = c;
- numbuf[1] = NUL;
-#endif
ga_concat(gap, numbuf);
}
else
ga_concat(gap, numbuf);
}
}
-#ifdef FEAT_MBYTE
res += utf_ptr2len(res);
-#else
- ++res;
-#endif
}
ga_append(gap, '"');
-#if defined(FEAT_MBYTE) && defined(USE_ICONV)
+#if defined(USE_ICONV)
vim_free(converted);
#endif
}
{
/* The JSON is always expected to be utf-8, thus use utf functions
* here. The string is converted below if needed. */
- if (*p == NUL || p[1] == NUL
-#ifdef FEAT_MBYTE
- || utf_ptr2len(p) < utf_byte2len(*p)
-#endif
- )
+ if (*p == NUL || p[1] == NUL || utf_ptr2len(p) < utf_byte2len(*p))
{
/* Not enough bytes to make a character or end of the string. Get
* more if possible. */
}
if (res != NULL)
{
-#ifdef FEAT_MBYTE
char_u buf[NUMBUFLEN];
buf[utf_char2bytes((int)nr, buf)] = NUL;
ga_concat(&ga, buf);
-#else
- ga_append(&ga, (int)nr);
-#endif
}
break;
default:
}
else
{
-#ifdef FEAT_MBYTE
len = utf_ptr2len(p);
-#else
- len = 1;
-#endif
if (res != NULL)
{
if (ga_grow(&ga, len) == FAIL)
{
ga_append(&ga, NUL);
res->v_type = VAR_STRING;
-#if defined(FEAT_MBYTE) && defined(USE_ICONV)
+#if defined(USE_ICONV)
if (!enc_utf8)
{
vimconv_T conv;
/* This file has to be included because the tested functions are static */
#include "charset.c"
-#ifdef FEAT_MBYTE
/*
* Test the results of vim_iswordc() and vim_iswordp() are matched.
*/
}
}
}
-#endif
int
main(void)
{
-#ifdef FEAT_MBYTE
test_isword_funcs_utf8();
-#endif
return 0;
}
*/
mch_early_init();
-#if defined(WIN32) && defined(FEAT_MBYTE)
+#if defined(WIN32)
/*
* MinGW expands command line arguments, which confuses our code to
* convert when 'encoding' changes. Get the unexpanded arguments.
params.fname = alist_name(&GARGLIST[0]);
}
-#if defined(WIN32) && defined(FEAT_MBYTE)
+#if defined(WIN32)
{
extern void set_alist_count(void);
{
char_u *enc = NULL;
-# ifdef FEAT_MBYTE
enc = p_menc;
-# endif
if (params.use_ef != NULL)
set_string_option_direct((char_u *)"ef", -1,
params.use_ef, OPT_FREE, SID_CARG);
/* Must come before the may_req_ calls. */
starting = 0;
-#if defined(FEAT_TERMRESPONSE) && defined(FEAT_MBYTE)
+#if defined(FEAT_TERMRESPONSE)
/* Must be done before redrawing, puts a few characters on the screen. */
may_req_ambiguous_char_width();
#endif
{
cmdline_init();
-#ifdef FEAT_MBYTE
(void)mb_init(); /* init mb_bytelen_tab[] to ones */
-#endif
#ifdef FEAT_EVAL
eval_init(); /* init global variables */
#endif
if (garbage_collect_at_exit)
garbage_collect(FALSE);
#endif
-#if defined(WIN32) && defined(FEAT_MBYTE)
+#if defined(WIN32)
free_cmd_argsW();
#endif
#endif
);
-#if defined(FEAT_MBYTE) && defined(WIN32)
+#if defined(WIN32)
{
/* Remember this argument has been added to the argument list.
* Needed when 'encoding' is changed. */
#if defined(WIN3264) && !defined(FEAT_GUI_W32)
if (is_cygpty_used())
{
-# if defined(FEAT_MBYTE) && defined(HAVE_BIND_TEXTDOMAIN_CODESET) \
+# if defined(HAVE_BIND_TEXTDOMAIN_CODESET) \
&& defined(FEAT_GETTEXT)
char *s, *tofree = NULL;
{
cmdsrv_main(&parmp->argc, parmp->argv,
parmp->serverName_arg, &parmp->serverStr);
-# ifdef FEAT_MBYTE
parmp->serverStrEnc = vim_strsave(p_enc);
-# endif
}
/* If we're still running, get the name to register ourselves.
char_u *res = data;
*tofree = NULL;
-# ifdef FEAT_MBYTE
if (client_enc != NULL && p_enc != NULL)
{
vimconv_T vimconv;
}
convert_setup(&vimconv, NULL, NULL);
}
-# endif
return res;
}
#endif
# endif
#endif
-#if defined(FEAT_MBYTE) || defined(PROTO)
-
static int dbcs_char2len(int c);
static int dbcs_char2bytes(int c, char_u *buf);
static int dbcs_ptr2len(char_u *p);
}
#endif
-#endif
-#if defined(FEAT_MBYTE) || defined(FEAT_POSTSCRIPT) || defined(PROTO)
/*
* Canonical encoding names and their properties.
* "iso-8859-n" is handled by enc_canonize() directly.
return -1;
}
-#endif
-
-#if defined(FEAT_MBYTE) || defined(PROTO)
/*
* Find canonical encoding "name" in the list and return its properties.
return col - 1;
return col;
}
-#endif
-#if defined(FEAT_MBYTE) || defined(FEAT_POSTSCRIPT) || defined(PROTO)
static int enc_alias_search(char_u *name);
/*
char_u *p, *s;
int i;
-# ifdef FEAT_MBYTE
if (STRCMP(enc, "default") == 0)
{
/* Use the default encoding as it's found by set_init_1(). */
r = (char_u *)"latin1";
return vim_strsave(r);
}
-# endif
/* copy "enc" to allocated memory, with room for two '-' */
r = alloc((unsigned)(STRLEN(enc) + 3));
return enc_alias_table[i].canon;
return -1;
}
-#endif
-#if defined(FEAT_MBYTE) || defined(PROTO)
-# ifdef HAVE_LANGINFO_H
-# include <langinfo.h>
-# endif
+#ifdef HAVE_LANGINFO_H
+# include <langinfo.h>
+#endif
-# ifndef FEAT_GUI_W32
+#ifndef FEAT_GUI_W32
/*
* Get the canonicalized encoding from the specified locale string "locale"
* or from the environment variables LC_ALL, LC_CTYPE and LANG.
return enc_canonize((char_u *)buf);
}
-# endif
+#endif
/*
* Get the canonicalized encoding of the current locale.
char_u *
enc_locale(void)
{
-# ifdef WIN3264
+#ifdef WIN3264
char buf[50];
long acp = GetACP();
sprintf(buf, "cp%ld", acp);
return enc_canonize((char_u *)buf);
-# else
+#else
char *s;
-# ifdef HAVE_NL_LANGINFO_CODESET
+# ifdef HAVE_NL_LANGINFO_CODESET
if ((s = nl_langinfo(CODESET)) == NULL || *s == NUL)
-# endif
-# if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
+# endif
+# if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
if ((s = setlocale(LC_CTYPE, NULL)) == NULL || *s == NUL)
-# endif
+# endif
s = NULL;
return enc_locale_env(s);
-# endif
+#endif
}
# if defined(WIN3264) || defined(PROTO) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD)
# endif /* DYNAMIC_ICONV */
# endif /* USE_ICONV */
-#endif /* FEAT_MBYTE */
#ifdef FEAT_GUI
# define USE_IMACTIVATEFUNC (!gui.in_use && *p_imaf != NUL)
# define USE_IMSTATUSFUNC (*p_imsf != NUL)
#endif
-#if defined(FEAT_EVAL) && defined(FEAT_MBYTE) \
- && (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM))
+#if defined(FEAT_EVAL) && (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM))
static void
call_imactivatefunc(int active)
{
int
im_get_status(void)
{
-# if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
+# if defined(FEAT_EVAL)
if (USE_IMSTATUSFUNC)
return call_imstatusfunc();
# endif
void
im_set_active(int active_arg)
{
-# if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
+# if defined(FEAT_EVAL)
int active = !p_imdisable && active_arg;
if (USE_IMACTIVATEFUNC && active != im_get_status())
#endif /* FEAT_XIM */
-#if defined(FEAT_MBYTE) || defined(PROTO)
/*
* Setup "vcp" for conversion from "from" to "to".
int to_is_utf8;
/* Reset to no conversion. */
-# ifdef USE_ICONV
+#ifdef USE_ICONV
if (vcp->vc_type == CONV_ICONV && vcp->vc_fd != (iconv_t)-1)
iconv_close(vcp->vc_fd);
-# endif
+#endif
vcp->vc_type = CONV_NONE;
vcp->vc_factor = 1;
vcp->vc_fail = FALSE;
vcp->vc_type = CONV_UTF8_MAC;
}
#endif
-# ifdef USE_ICONV
+#ifdef USE_ICONV
else
{
/* Use iconv() for conversion. */
vcp->vc_factor = 4; /* could be longer too... */
}
}
-# endif
+#endif
if (vcp->vc_type == CONV_NONE)
return FAIL;
return retval;
}
-#endif
static void ml_upd_block0(buf_T *buf, upd_block0_T what);
static void set_b0_fname(ZERO_BL *, buf_T *buf);
static void set_b0_dir_flag(ZERO_BL *b0p, buf_T *buf);
-#ifdef FEAT_MBYTE
static void add_b0_fenc(ZERO_BL *b0p, buf_T *buf);
-#endif
static time_t swapfile_info(char_u *);
static int recov_file_names(char_u **, char_u *, int prepend_dot);
static int ml_append_int(buf_T *, linenr_T, char_u *, colnr_T, int, int);
}
}
-#ifdef FEAT_MBYTE
/* Also add the 'fileencoding' if there is room. */
add_b0_fenc(b0p, curbuf);
-#endif
}
/*
b0p->b0_flags &= ~B0_SAME_DIR;
}
-#ifdef FEAT_MBYTE
/*
* When there is room, add the 'fileencoding' to block zero.
*/
int n;
int size = B0_FNAME_SIZE_NOCRYPT;
-# ifdef FEAT_CRYPT
+#ifdef FEAT_CRYPT
/* Without encryption use the same offset as in Vim 7.2 to be compatible.
* With encryption it's OK to move elsewhere, the swap file is not
* compatible anyway. */
if (*buf->b_p_key != NUL)
size = B0_FNAME_SIZE_CRYPT;
-# endif
+#endif
n = (int)STRLEN(buf->b_p_fenc);
if ((int)STRLEN(b0p->b0_fname) + n + 1 > size)
b0p->b0_flags |= B0_HAS_FENC;
}
}
-#endif
/*
b0p->b0_dirty = buf->b_changed ? B0_DIRTY : 0;
b0p->b0_flags = (b0p->b0_flags & ~B0_FF_MASK)
| (get_fileformat(buf) + 1);
-#ifdef FEAT_MBYTE
add_b0_fenc(b0p, buf);
-#endif
hp->bh_flags |= BH_DIRTY;
mf_sync(buf->b_ml.ml_mfp, MFS_ZERO);
break;
}
check_cursor();
-# ifdef FEAT_MBYTE
/* Make sure the cursor is on the first byte of a multi-byte char. */
if (has_mbyte)
mb_adjust_cursor();
-# endif
}
#endif
room = (int)(Rows - msg_row - 1) * Columns + sc_col - 1;
if (len > room && room > 0)
{
-#ifdef FEAT_MBYTE
if (enc_utf8)
/* may have up to 18 bytes per cell (6 per char, up to two
* composing chars) */
/* may have up to 2 bytes per cell for euc-jp */
len = (room + 2) * 2;
else
-#endif
len = room + 2;
buf = alloc(len);
if (buf != NULL)
break;
len += n;
buf[e] = s[e];
-#ifdef FEAT_MBYTE
if (has_mbyte)
for (n = (*mb_ptr2len)(s + e); --n > 0; )
{
break;
buf[e] = s[e];
}
-#endif
}
/* Last part: End of the string. */
i = e;
-#ifdef FEAT_MBYTE
if (enc_dbcs != 0)
{
/* For DBCS going backwards in a string is slow, but
}
}
else
-#endif
{
for (i = (int)STRLEN(s); len + (n = ptr2cells(s + i - 1)) <= room; --i)
len += n;
if ((force || (shortmess(SHM_TRUNC) && !exmode_active))
&& (n = (int)STRLEN(s) - room) > 0)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
int size = vim_strsize(s);
}
--n;
}
-#endif
s += n;
*s = '<';
}
void
msg_putchar_attr(int c, int attr)
{
-#ifdef FEAT_MBYTE
char_u buf[MB_MAXBYTES + 1];
-#else
- char_u buf[4];
-#endif
if (IS_SPECIAL(c))
{
buf[3] = NUL;
}
else
- {
-#ifdef FEAT_MBYTE
buf[(*mb_char2bytes)(c, buf)] = NUL;
-#else
- buf[0] = c;
- buf[1] = NUL;
-#endif
- }
msg_puts_attr((char *)buf, attr);
}
char_u *
msg_outtrans_one(char_u *p, int attr)
{
-#ifdef FEAT_MBYTE
int l;
if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
msg_outtrans_len_attr(p, l, attr);
return p + l;
}
-#endif
msg_puts_attr((char *)transchar_byte(*p), attr);
return p + 1;
}
char_u *str = msgstr;
char_u *plain_start = msgstr;
char_u *s;
-#ifdef FEAT_MBYTE
int mb_l;
int c;
-#endif
/* if MSG_HIST flag set, add message to history */
if (attr & MSG_HIST)
attr &= ~MSG_HIST;
}
-#ifdef FEAT_MBYTE
/* If the string starts with a composing character first draw a space on
* which the composing char can be drawn. */
if (enc_utf8 && utf_iscomposing(utf_ptr2char(msgstr)))
msg_puts_attr(" ", attr);
-#endif
/*
* Go over the string. Special characters are translated and printed.
*/
while (--len >= 0)
{
-#ifdef FEAT_MBYTE
if (enc_utf8)
/* Don't include composing chars after the end. */
mb_l = utfc_ptr2len_len(str, len + 1);
str += mb_l;
}
else
-#endif
{
s = transchar_byte(*str);
if (s[1] != NUL)
len = vim_strsize((char_u *)text);
/* Highlight special keys */
msg_puts_attr(text, len > 1
-#ifdef FEAT_MBYTE
- && (*mb_ptr2len)((char_u *)text) <= 1
-#endif
- ? attr : 0);
+ && (*mb_ptr2len)((char_u *)text) <= 1 ? attr : 0);
retval += len;
}
return retval;
int modifiers = 0;
int special = FALSE;
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
char_u *p;
if (p != NULL)
return p;
}
-#endif
c = *str;
if (c == K_SPECIAL && str[1] != NUL && str[2] != NUL)
special = TRUE;
}
-#ifdef FEAT_MBYTE
if (has_mbyte && !IS_SPECIAL(c))
{
int len = (*mb_ptr2len)(str);
*sp = str + len;
}
else
-#endif
*sp = str + 1;
/* Make unprintable characters in <> form, also <M-Space> and <Tab>.
int n;
int attr = 0;
char_u *trail = NULL;
-#ifdef FEAT_MBYTE
int l;
char_u buf[MB_MAXBYTES + 1];
-#endif
if (curwin->w_p_list)
list = TRUE;
else
c = *p_extra++;
}
-#ifdef FEAT_MBYTE
else if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1)
{
col += (*mb_ptr2cells)(s);
s += l;
continue;
}
-#endif
else
{
attr = 0;
msg_clr_eos();
}
-#ifdef FEAT_MBYTE
/*
* Use screen_puts() to output one multi-byte character.
* Return the pointer "s" advanced to the next character.
}
return s + l;
}
-#endif
/*
* Output a string to the screen at position msg_row, msg_col.
char_u *s = str;
char_u *t_s = str; /* string from "t_s" to "s" is still todo */
int t_col = 0; /* screen cells todo, 0 when "t_s" not used */
-#ifdef FEAT_MBYTE
int l;
int cw;
-#endif
char_u *sb_str = str;
int sb_col = msg_col;
int wrap;
cmdmsg_rl
? (
msg_col <= 1
- || (*s == TAB && msg_col <= 7)
-# ifdef FEAT_MBYTE
- || (has_mbyte && (*mb_ptr2cells)(s) > 1 && msg_col <= 2)
-# endif
- )
+ || (*s == TAB && msg_col <= 7)
+ || (has_mbyte && (*mb_ptr2cells)(s) > 1 && msg_col <= 2))
:
#endif
(msg_col + t_col >= Columns - 1
|| (*s == TAB && msg_col + t_col >= ((Columns - 1) & ~7))
-# ifdef FEAT_MBYTE
|| (has_mbyte && (*mb_ptr2cells)(s) > 1
- && msg_col + t_col >= Columns - 2)
-# endif
- ))))
+ && msg_col + t_col >= Columns - 2)))))
{
/*
* The screen is scrolled up when at the last row (some terminals
#endif
)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
if (enc_utf8 && maxlen >= 0)
s = screen_puts_mbyte(s, l, attr);
}
else
-#endif
msg_screen_putchar(*s++, attr);
did_last_char = TRUE;
}
wrap = *s == '\n'
|| msg_col + t_col >= Columns
-#ifdef FEAT_MBYTE
|| (has_mbyte && (*mb_ptr2cells)(s) > 1
- && msg_col + t_col >= Columns - 1)
-#endif
- ;
+ && msg_col + t_col >= Columns - 1);
if (t_col > 0 && (wrap || *s == '\r' || *s == '\b'
|| *s == '\t' || *s == BELL))
/* output any postponed text */
vim_beep(BO_SH);
else
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
cw = (*mb_ptr2cells)(s);
cw = 1;
l = 1;
}
-#endif
+
/* When drawing from right to left or when a double-wide character
* doesn't fit, draw a single character here. Otherwise collect
* characters and draw them all at once later. */
-#if defined(FEAT_RIGHTLEFT) || defined(FEAT_MBYTE)
if (
# ifdef FEAT_RIGHTLEFT
- cmdmsg_rl
-# ifdef FEAT_MBYTE
- ||
-# endif
+ cmdmsg_rl ||
# endif
-# ifdef FEAT_MBYTE
- (cw > 1 && msg_col + t_col >= Columns - 1)
-# endif
- )
+ (cw > 1 && msg_col + t_col >= Columns - 1))
{
-# ifdef FEAT_MBYTE
if (l > 1)
s = screen_puts_mbyte(s, l, attr) - 1;
else
-# endif
msg_screen_putchar(*s, attr);
}
else
-#endif
{
/* postpone this character until later */
if (t_col == 0)
t_s = s;
-#ifdef FEAT_MBYTE
t_col += cw;
s += l - 1;
-#else
- ++t_col;
-#endif
}
}
++s;
screen_puts_len(t_s, (int)(s - t_s), msg_row, msg_col, attr);
msg_col += *t_col;
*t_col = 0;
-#ifdef FEAT_MBYTE
/* If the string starts with a composing character don't increment the
* column position for it. */
if (enc_utf8 && utf_iscomposing(utf_ptr2char(t_s)))
--msg_col;
-#endif
if (msg_col >= Columns)
{
msg_col = 0;
char_u buf[4];
char_u *p;
#ifdef WIN3264
-# if defined(FEAT_MBYTE) && !defined(FEAT_GUI_MSWIN)
+# if !defined(FEAT_GUI_MSWIN)
char_u *ccp = NULL;
# endif
if (!(silent_mode && p_verbose == 0))
mch_settmode(TMODE_COOK); /* handle '\r' and '\n' correctly */
-# if defined(FEAT_MBYTE) && !defined(FEAT_GUI_MSWIN)
+# if !defined(FEAT_GUI_MSWIN)
if (enc_codepage >= 0 && (int)GetConsoleCP() != enc_codepage)
{
int inlen = (int)STRLEN(str);
msg_didout = TRUE; /* assume that line is not empty */
#ifdef WIN3264
-# if defined(FEAT_MBYTE) && !defined(FEAT_GUI_MSWIN)
+# if !defined(FEAT_GUI_MSWIN)
vim_free(ccp);
# endif
if (!(silent_mode && p_verbose == 0))
retval = 1;
for (i = 0; hotkeys[i]; ++i)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
if ((*mb_ptr2char)(hotkeys + i) == c)
i += (*mb_ptr2len)(hotkeys + i) - 1;
}
else
-#endif
if (hotkeys[i] == c)
break;
++retval;
char_u *to,
int lowercase) /* make character lower case */
{
-#ifdef FEAT_MBYTE
int len;
int c;
}
}
else
-#endif
{
if (lowercase)
*to = (char_u)TOLOWER_LOC(*from);
int dfltbutton)
{
int len = 0;
-#ifdef FEAT_MBYTE
-# define HOTK_LEN (has_mbyte ? MB_MAXBYTES : 1)
-#else
-# define HOTK_LEN 1
-#endif
+#define HOTK_LEN (has_mbyte ? MB_MAXBYTES : 1)
int lenhotkey = HOTK_LEN; /* count first button */
char_u *hotk = NULL;
char_u *msgp = NULL;
*msgp++ = ' '; /* '\n' -> ', ' */
/* advance to next hotkey and set default hotkey */
-#ifdef FEAT_MBYTE
if (has_mbyte)
hotkp += STRLEN(hotkp);
else
-#endif
++hotkp;
hotkp[copy_char(r + 1, hotkp, TRUE)] = NUL;
if (dfltbutton)
str_arg_l = (q == NULL) ? precision
: (size_t)(q - str_arg);
}
-# ifdef FEAT_MBYTE
if (fmt_spec == 'S')
{
if (min_field_width != 0)
str_arg_l = precision = p1 - (char_u *)str_arg;
}
}
-# endif
break;
default:
p = saved_line + curwin->w_cursor.col;
while (*p != NUL)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
p += replace_push_mb(p);
else
-#endif
replace_push(*p++);
}
saved_line[curwin->w_cursor.col] = NUL;
;
++p;
-#ifdef FEAT_MBYTE
/* Compute the length of the replaced characters in
* screen characters, not bytes. */
{
(size_t)((leader + lead_len) - endp));
lead_len += l;
}
-#else
- if (p < leader + lead_repl_len)
- p = leader;
- else
- p -= lead_repl_len;
-#endif
mch_memmove(p, lead_repl, (size_t)lead_repl_len);
if (p + lead_repl_len > leader + lead_len)
p[lead_repl_len] = NUL;
/* blank-out any other chars from the old leader. */
while (--p >= leader)
{
-#ifdef FEAT_MBYTE
int l = mb_head_off(leader, p);
if (l > 1)
lead_len -= l;
*p = ' ';
}
- else
-#endif
- if (!VIM_ISWHITE(*p))
+ else if (!VIM_ISWHITE(*p))
*p = ' ';
}
}
else /* left adjusted leader */
{
p = skipwhite(leader);
-#ifdef FEAT_MBYTE
+
/* Compute the length of the replaced characters in
* screen characters, not bytes. Move the part that is
* not to be overwritten. */
lead_len += lead_repl_len - i;
}
}
-#endif
mch_memmove(p, lead_repl, (size_t)lead_repl_len);
/* Replace any remaining non-white chars in the old
}
else
{
-#ifdef FEAT_MBYTE
int l = (*mb_ptr2len)(p);
if (l > 1)
(leader + lead_len) - p);
lead_len -= l - 1;
}
-#endif
*p = ' ';
}
}
if (curbuf->b_p_ai || (flags & OPENLINE_DELSPACES))
{
while ((*p_extra == ' ' || *p_extra == '\t')
-#ifdef FEAT_MBYTE
&& (!enc_utf8
- || !utf_iscomposing(utf_ptr2char(p_extra + 1)))
-#endif
- )
+ || !utf_iscomposing(utf_ptr2char(p_extra + 1))))
{
if (REPLACE_NORMAL(State))
replace_push(*p_extra);
ins_bytes_len(char_u *p, int len)
{
int i;
-#ifdef FEAT_MBYTE
int n;
if (has_mbyte)
ins_char_bytes(p + i, n);
}
else
-#endif
for (i = 0; i < len; ++i)
ins_char(p[i]);
}
ins_char(int c)
{
char_u buf[MB_MAXBYTES + 1];
- int n = 1;
-
-#ifdef FEAT_MBYTE
- n = (*mb_char2bytes)(c, buf);
+ int n = (*mb_char2bytes)(c, buf);
/* When "c" is 0x100, 0x200, etc. we don't want to insert a NUL byte.
* Happens for CTRL-Vu9900. */
if (buf[0] == 0)
buf[0] = '\n';
-#else
- buf[0] = c;
-#endif
ins_char_bytes(buf, n);
}
colnr_T new_vcol = 0; /* init for GCC */
colnr_T vcol;
int old_list;
-#ifndef FEAT_MBYTE
- char_u cbuf[2];
-#endif
/*
* Disable 'list' temporarily, unless 'cpo' contains the 'L' flag.
* cells. May result in adding spaces to fill a gap.
*/
getvcol(curwin, &curwin->w_cursor, NULL, &vcol, NULL);
-#ifndef FEAT_MBYTE
- cbuf[0] = c;
- cbuf[1] = NUL;
- new_vcol = vcol + chartabsize(cbuf, vcol);
-#else
new_vcol = vcol + chartabsize(buf, vcol);
-#endif
while (oldp[col + oldlen] != NUL && vcol < new_vcol)
{
vcol += chartabsize(oldp + col + oldlen, vcol);
* position. */
if (vcol > new_vcol && oldp[col + oldlen] == TAB)
break;
-#ifdef FEAT_MBYTE
oldlen += (*mb_ptr2len)(oldp + col + oldlen);
-#else
- ++oldlen;
-#endif
/* Deleted a bit too much, insert spaces. */
if (vcol > new_vcol)
newlen += vcol - new_vcol;
else if (oldp[col] != NUL)
{
/* normal replace */
-#ifdef FEAT_MBYTE
oldlen = (*mb_ptr2len)(oldp + col);
-#else
- oldlen = 1;
-#endif
}
replace_push(NUL);
for (i = 0; i < oldlen; ++i)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
i += replace_push_mb(oldp + col + i) - 1;
else
-#endif
replace_push(oldp[col + i]);
}
}
(size_t)(linelen - col - oldlen));
/* Insert or overwrite the new character. */
-#ifdef FEAT_MBYTE
mch_memmove(p, buf, charlen);
i = charlen;
-#else
- *p = c;
- i = 1;
-#endif
/* Fill with spaces when necessary. */
while (i < newlen)
#endif
)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
showmatch(mb_ptr2char(buf));
else
-#endif
showmatch(c);
}
#endif
{
/* Normal insert: move cursor right */
-#ifdef FEAT_MBYTE
curwin->w_cursor.col += charlen;
-#else
- ++curwin->w_cursor.col;
-#endif
}
/*
* TODO: should try to update w_row here, to avoid recomputing it later.
int
del_char(int fixpos)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
/* Make sure the cursor is at the start of a character. */
return FAIL;
return del_chars(1L, fixpos);
}
-#endif
return del_bytes(1L, fixpos, TRUE);
}
-#if defined(FEAT_MBYTE) || defined(PROTO)
/*
* Like del_bytes(), but delete characters instead of bytes.
*/
}
return del_bytes(bytes, fixpos, TRUE);
}
-#endif
/*
* Delete "count" bytes under the cursor.
return FAIL;
}
-#ifdef FEAT_MBYTE
/* If 'delcombine' is set and deleting (less than) one character, only
* delete the last combining character. */
if (p_deco && use_delcombine && enc_utf8
fixpos = 0;
}
}
-#endif
/*
* When count is too big, reduce it.
#ifdef FEAT_VIRTUALEDIT
curwin->w_cursor.coladd = 0;
#endif
-#ifdef FEAT_MBYTE
if (has_mbyte)
curwin->w_cursor.col -=
(*mb_head_off)(oldp, oldp + curwin->w_cursor.col);
-#endif
}
count = oldlen - col;
movelen = 1;
if (pos->col == MAXCOL)
return NUL;
ptr = ml_get_pos(pos);
-#ifdef FEAT_MBYTE
if (has_mbyte)
return (*mb_ptr2char)(ptr);
-#endif
return (int)*ptr;
}
int
gchar_cursor(void)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
return (*mb_ptr2char)(ml_get_cursor());
-#endif
return (int)*ml_get_cursor();
}
}
break;
}
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
if (MB_BYTE2LEN(n) > len)
buf[len >= buflen ? buflen - 1 : len] = NUL;
n = (*mb_ptr2char)(buf);
}
-#endif
#ifdef UNIX
if (n == intr_char)
n = ESC;
if (var != NULL && *var == NUL) /* empty is same as not set */
var = NULL;
-# ifdef FEAT_MBYTE
if (enc_utf8 && var != NULL)
{
int len;
return;
}
}
-# endif
/*
* Default home dir is C:/
if (p != NULL)
{
-#if defined(FEAT_MBYTE) && defined(WIN3264)
+#if defined(WIN3264)
if (enc_utf8)
{
int len;
else
p = mch_getenv((char_u *)"VIM");
-#if defined(FEAT_MBYTE) && defined(WIN3264)
+#if defined(WIN3264)
if (enc_utf8)
{
int len;
*d++ = *s; /* copy next char */
if (*s != '~' && *s != '.') /* and leading "~" and "." */
skip = TRUE;
-# ifdef FEAT_MBYTE
if (has_mbyte)
{
int l = mb_ptr2len(s);
while (--l > 0)
*d++ = *++s;
}
-# endif
}
}
}
static int stardepth = 0; /* depth for "**" expansion */
WIN32_FIND_DATA fb;
HANDLE hFind = (HANDLE)0;
-# ifdef FEAT_MBYTE
WIN32_FIND_DATAW wfb;
WCHAR *wn = NULL; /* UCS-2 name, NULL when not used. */
-# endif
char_u *matchname;
int ok;
return 0;
}
- /* Make room for file name. When doing encoding conversion the actual
- * length may be quite a bit longer, thus use the maximum possible length. */
+ // Make room for file name. When doing encoding conversion the actual
+ // length may be quite a bit longer, thus use the maximum possible length.
buf = alloc((int)MAXPATHL);
if (buf == NULL)
return 0;
else if (path_end >= path + wildoff
&& vim_strchr((char_u *)"*?[~", *path_end) != NULL)
e = p;
-# ifdef FEAT_MBYTE
if (has_mbyte)
{
len = (*mb_ptr2len)(path_end);
path_end += len;
}
else
-# endif
*p++ = *path_end++;
}
e = p;
/* Scan all files in the directory with "dir/ *.*" */
STRCPY(s, "*.*");
-# ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
/* The active codepage differs from 'encoding'. Attempt using the
}
if (wn == NULL)
-# endif
hFind = FindFirstFile((LPCSTR)buf, &fb);
ok = (hFind != INVALID_HANDLE_VALUE);
while (ok)
{
-# ifdef FEAT_MBYTE
if (wn != NULL)
p = utf16_to_enc(wfb.cFileName, NULL); /* p is allocated here */
else
-# endif
p = (char_u *)fb.cFileName;
/* Ignore entries starting with a dot, unless when asked for. Accept
* all entries found with "matchname". */
}
}
-# ifdef FEAT_MBYTE
if (wn != NULL)
{
vim_free(p);
ok = FindNextFileW(hFind, &wfb);
}
else
-# endif
ok = FindNextFile(hFind, &fb);
/* If no more matches and no match was used, try expanding the name
{
STRCPY(s, matchname);
FindClose(hFind);
-# ifdef FEAT_MBYTE
if (wn != NULL)
{
vim_free(wn);
hFind = FindFirstFileW(wn, &wfb);
}
if (wn == NULL)
-# endif
hFind = FindFirstFile((LPCSTR)buf, &fb);
ok = (hFind != INVALID_HANDLE_VALUE);
VIM_CLEAR(matchname);
}
FindClose(hFind);
-# ifdef FEAT_MBYTE
vim_free(wn);
-# endif
vim_free(buf);
vim_regfree(regmatch.regprog);
vim_free(matchname);
|| (!p_fic && (flags & EW_ICASE)
&& isalpha(PTR2CHAR(path_end)))))
e = p;
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
len = (*mb_ptr2len)(path_end);
path_end += len;
}
else
-#endif
*p++ = *path_end++;
}
e = p;
* Get the screen position of character col with a coladd in the cursor line.
*/
int
-getviscol2(colnr_T col, colnr_T coladd)
+getviscol2(colnr_T col, colnr_T coladd UNUSED)
{
colnr_T x;
pos_T pos;
}
#endif
-#ifdef FEAT_MBYTE
/* prevent from moving onto a trail byte */
if (has_mbyte)
mb_adjustpos(curbuf, pos);
-#endif
if (col < wcol)
return FAIL;
p = ml_get_pos(lp);
if (*p != NUL) /* still within line, move to next char (may be NUL) */
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
int l = (*mb_ptr2len)(p);
lp->col += l;
return ((p[l] != NUL) ? 0 : 2);
}
-#endif
lp->col++;
#ifdef FEAT_VIRTUALEDIT
lp->coladd = 0;
/* past end of line */
p = ml_get(lp->lnum);
lp->col = (colnr_T)STRLEN(p);
-#ifdef FEAT_MBYTE
if (has_mbyte)
lp->col -= (*mb_head_off)(p, p + lp->col);
-#endif
return 0;
}
{
/* still within line */
lp->col--;
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
p = ml_get(lp->lnum);
lp->col -= (*mb_head_off)(p, p + lp->col);
}
-#endif
return 0;
}
lp->lnum--;
p = ml_get(lp->lnum);
lp->col = (colnr_T)STRLEN(p);
-#ifdef FEAT_MBYTE
if (has_mbyte)
lp->col -= (*mb_head_off)(p, p + lp->col);
-#endif
return 1;
}
else
{
win->w_cursor.col = len - 1;
-#ifdef FEAT_MBYTE
/* Move the cursor to the head byte. */
if (has_mbyte)
mb_adjustpos(win->w_buffer, &win->w_cursor);
-#endif
}
}
else if (win->w_cursor.col < 0)
char_u *p2;
char_u *escaped_string;
unsigned length;
-#ifdef FEAT_MBYTE
int l;
-#endif
/*
* First count the number of backslashes required.
length = 1; /* count the trailing NUL */
for (p = string; *p; p++)
{
-#ifdef FEAT_MBYTE
if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
{
length += l; /* count a multibyte char */
p += l - 1;
continue;
}
-#endif
if (vim_strchr(esc_chars, *p) != NULL || (bsl && rem_backslash(p)))
++length; /* count a backslash */
++length; /* count an ordinary char */
p2 = escaped_string;
for (p = string; *p; p++)
{
-#ifdef FEAT_MBYTE
if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
{
mch_memmove(p2, p, (size_t)l);
p += l - 1; /* skip multibyte char */
continue;
}
-#endif
if (vim_strchr(esc_chars, *p) != NULL || (bsl && rem_backslash(p)))
*p2++ = cc;
*p2++ = *p;
if (res != NULL)
while (*p != NUL)
{
-# ifdef FEAT_MBYTE
int l;
if (enc_utf8)
else if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
p += l; /* skip multi-byte character */
else
-# endif
{
*p = TOUPPER_LOC(*p); /* note that toupper() can be a macro */
p++;
if (res != NULL)
while (*p != NUL)
{
-# ifdef FEAT_MBYTE
int l;
if (enc_utf8)
else if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
p += l; /* skip multi-byte character */
else
-# endif
{
*p = TOLOWER_LOC(*p); /* note that tolower() can be a macro */
p++;
int b;
p = string;
-#ifdef FEAT_MBYTE
if (enc_utf8 && c >= 0x80)
{
while (*p != NUL)
}
return NULL;
}
-#endif
while ((b = *p) != NUL)
{
if (b == c)
* When not a known special key, and not a printable character, try to
* extract modifiers.
*/
- if (c > 0
-#ifdef FEAT_MBYTE
- && (*mb_char2len)(c) == 1
-#endif
- )
+ if (c > 0 && (*mb_char2len)(c) == 1)
{
if (table_idx < 0
&& (!vim_isprintc(c) || (c & 0x7f) == ' ')
/* Not a special key, only modifiers, output directly */
else
{
-#ifdef FEAT_MBYTE
if (has_mbyte && (*mb_char2len)(c) > 1)
idx += (*mb_char2bytes)(c, string + idx);
- else
-#endif
- if (vim_isprintc(c))
+ else if (vim_isprintc(c))
string[idx++] = c;
else
{
dst[dlen++] = KEY2TERMCAP0(key);
dst[dlen++] = KEY2TERMCAP1(key);
}
-#ifdef FEAT_MBYTE
else if (has_mbyte && !keycode)
dlen += (*mb_char2bytes)(key, dst + dlen);
-#endif
else if (keycode)
dlen = (int)(add_char2buf(key, dst + dlen) - dst);
else
last_dash = bp;
if (bp[1] != NUL)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
l = mb_ptr2len(bp + 1);
else
-#endif
l = 1;
/* Anything accepted, like <C-?>.
* <C-"> or <M-"> are not special in strings as " is
/* Modifier with single letter, or special key name. */
if (in_string && last_dash[1] == '\\' && last_dash[2] == '"')
off = 2;
-#ifdef FEAT_MBYTE
if (has_mbyte)
l = mb_ptr2len(last_dash + off);
else
-#endif
l = 1;
if (modifiers != 0 && last_dash[l + off] == '>')
key = PTR2CHAR(last_dash + off);
if (!(modifiers & MOD_MASK_CMD))
#endif
if ((modifiers & MOD_MASK_ALT) && key < 0x80
-#ifdef FEAT_MBYTE
- && !enc_dbcs /* avoid creating a lead byte */
-#endif
- )
+ && !enc_dbcs) // avoid creating a lead byte
{
key |= 0x80;
modifiers &= ~MOD_MASK_ALT; /* remove the META modifier */
return State;
}
-#if defined(FEAT_MBYTE) || defined(PROTO)
/*
* Return TRUE if "p" points to just after a path separator.
* Takes care of multi-byte characters.
return p > b && vim_ispathsep(p[-1])
&& (!has_mbyte || (*mb_head_off)(b, p - 1) == 0);
}
-#endif
/*
* Return TRUE if file names "f1" and "f2" are in the same directory.
#endif
-#if (defined(FEAT_MBYTE) && defined(FEAT_QUICKFIX)) \
- || defined(FEAT_SPELL) || defined(PROTO)
+#if defined(FEAT_QUICKFIX) || defined(FEAT_SPELL) || defined(PROTO)
/*
* Return TRUE if string "s" contains a non-ASCII character (128 or higher).
* When "s" is NULL FALSE is returned.
}
/*
- * compute curwin->w_wcol and curwin->w_virtcol.
+ * Compute curwin->w_wcol and curwin->w_virtcol.
* Also updates curwin->w_wrow and curwin->w_cline_row.
* Also updates curwin->w_leftcol.
*/
validate_cursor();
# endif
restart_edit = restart_edit_save;
-# ifdef FEAT_MBYTE
/* Correct cursor for multi-byte character. */
if (has_mbyte)
mb_adjust_cursor();
-# endif
redraw_later(VALID);
/* Only scroll when 'scrollbind' hasn't done this. */
int top, bot;
int c;
-#ifdef FEAT_MBYTE
/* A multi-byte character is never a command. */
if (cmdchar >= 0x100)
return -1;
-#endif
/* We use the absolute value of the character. Special keys have a
* negative value, but are sorted on their absolute value. */
}
}
-#ifdef FEAT_MBYTE
/* When getting a text character and the next character is a
* multi-byte character, it could be a composing character.
* However, don't wait for it to arrive. Also, do enable mapping,
ca.ncharC2 = c;
}
++no_mapping;
-#endif
}
--no_mapping;
--allow_keys;
checkpcmark(); /* check if we moved since setting pcmark */
vim_free(ca.searchbuf);
-#ifdef FEAT_MBYTE
if (has_mbyte)
mb_adjust_cursor();
-#endif
if (curwin->w_p_scb && toplevel)
{
}
}
-#ifdef FEAT_MBYTE
/* Include the trailing byte of a multi-byte char. */
if (has_mbyte && oap->inclusive)
{
if (l > 1)
oap->end.col += l - 1;
}
-#endif
curwin->w_set_curswant = TRUE;
/*
{
find_start_of_word(&VIsual);
if (*p_sel == 'e' && *ml_get_cursor() != NUL)
-#ifdef FEAT_MBYTE
curwin->w_cursor.col +=
(*mb_ptr2len)(ml_get_cursor());
-#else
- ++curwin->w_cursor.col;
-#endif
find_end_of_word(&curwin->w_cursor);
}
}
while (pos->col > 0)
{
col = pos->col - 1;
-#ifdef FEAT_MBYTE
col -= (*mb_head_off)(line, line + col);
-#endif
if (get_mouse_class(line + col) != cclass)
break;
pos->col = col;
if (*p_sel == 'e' && pos->col > 0)
{
--pos->col;
-#ifdef FEAT_MBYTE
pos->col -= (*mb_head_off)(line, line + pos->col);
-#endif
}
cclass = get_mouse_class(line + pos->col);
while (line[pos->col] != NUL)
{
-#ifdef FEAT_MBYTE
col = pos->col + (*mb_ptr2len)(line + pos->col);
-#else
- col = pos->col + 1;
-#endif
if (get_mouse_class(line + col) != cclass)
{
if (*p_sel == 'e')
{
int c;
-#ifdef FEAT_MBYTE
if (has_mbyte && MB_BYTE2LEN(p[0]) > 1)
return mb_get_class(p);
-#endif
c = *p;
if (c == ' ' || c == '\t')
char_u *ptr;
int col = 0; /* init to shut up GCC */
int i;
-#ifdef FEAT_MBYTE
int this_class = 0;
int prev_class;
int prevcol;
-#endif
int bn = 0; /* bracket nesting */
/*
* 1. skip to start of identifier/string
*/
col = startcol;
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
while (ptr[col] != NUL)
}
}
else
-#endif
while (ptr[col] != NUL
&& (i == 0 ? !vim_iswordc(ptr[col]) : VIM_ISWHITE(ptr[col]))
&& (!(find_type & FIND_EVAL) || ptr[col] != ']')
/*
* 2. Back up to start of identifier/string.
*/
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
/* Remember class of character under cursor. */
break;
}
else
-#endif
{
while (col > 0
&& ((i == 0
}
}
- if (ptr[col] == NUL || (i == 0 && (
-#ifdef FEAT_MBYTE
- has_mbyte ? this_class != 2 :
-#endif
- !vim_iswordc(ptr[col]))))
+ if (ptr[col] == NUL || (i == 0
+ && (has_mbyte ? this_class != 2 : !vim_iswordc(ptr[col]))))
{
/*
* didn't find an identifier or string
bn = 0;
startcol -= col;
col = 0;
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
/* Search for point of changing multibyte character class. */
col += (*mb_ptr2len)(ptr + col);
}
else
-#endif
while ((i == 0 ? vim_iswordc(ptr[col])
: (ptr[col] != NUL && !VIM_ISWHITE(ptr[col])))
|| ((find_type & FIND_EVAL)
}
while ((*p_sel != 'e') ? s <= e : s < e)
{
-# ifdef FEAT_MBYTE
l = (*mb_ptr2len)(s);
-# else
- l = (*s == NUL) ? 0 : 1;
-# endif
if (l == 0)
{
++bytes;
else
coladvance(curwin->w_curswant);
-#if defined(FEAT_LINEBREAK) || defined(FEAT_MBYTE)
if (curwin->w_cursor.col > 0 && curwin->w_p_wrap)
{
colnr_T virtcol;
*/
validate_virtcol();
virtcol = curwin->w_virtcol;
-# if defined(FEAT_LINEBREAK)
+#if defined(FEAT_LINEBREAK)
if (virtcol > (colnr_T)width1 && *p_sbr != NUL)
virtcol -= vim_strsize(p_sbr);
-# endif
+#endif
if (virtcol > curwin->w_curswant
&& (curwin->w_curswant < (colnr_T)width1
> (colnr_T)width2 / 2)))
--curwin->w_cursor.col;
}
-#endif
if (atend)
curwin->w_curswant = MAXCOL; /* stick in the last column */
/* put a backslash before \ and some others */
if (vim_strchr(aux_ptr, *ptr) != NULL)
*p++ = '\\';
-#ifdef FEAT_MBYTE
/* When current byte is a part of multibyte character, copy all
* bytes of that character. */
if (has_mbyte)
for (i = 0; i < len && n >= 1; ++i, --n)
*p++ = *ptr++;
}
-#endif
*p++ = *ptr++;
}
*p = NUL;
*/
if (cmdchar == '*' || cmdchar == '#')
{
- if (!g_cmd && (
-#ifdef FEAT_MBYTE
- has_mbyte ? vim_iswordp(mb_prevptr(ml_get_curline(), ptr)) :
-#endif
- vim_iswordc(ptr[-1])))
+ if (!g_cmd && (has_mbyte
+ ? vim_iswordp(mb_prevptr(ml_get_curline(), ptr))
+ : vim_iswordc(ptr[-1])))
STRCAT(buf, "\\>");
#ifdef FEAT_CMDHIST
/* put pattern in search history */
*pp = ml_get_pos(&VIsual);
*lenp = curwin->w_cursor.col - VIsual.col + 1;
}
-#ifdef FEAT_MBYTE
if (has_mbyte)
/* Correct the length to include the whole last character. */
*lenp += (*mb_ptr2len)(*pp + (*lenp - 1)) - 1;
-#endif
}
reset_VIsual_and_resel();
return OK;
else
#endif
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
curwin->w_cursor.col +=
(*mb_ptr2len)(ml_get_cursor());
else
-#endif
++curwin->w_cursor.col;
}
}
if (*cp != NUL)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
curwin->w_cursor.col += (*mb_ptr2len)(cp);
else
-#endif
++curwin->w_cursor.col;
}
cap->retval |= CA_NO_ADJ_OP_END;
/* Abort if not enough characters to replace. */
ptr = ml_get_cursor();
if (STRLEN(ptr) < (unsigned)cap->count1
-#ifdef FEAT_MBYTE
- || (has_mbyte && mb_charlen(ptr) < cap->count1)
-#endif
- )
+ || (has_mbyte && mb_charlen(ptr) < cap->count1))
{
clearopbeep(cap->oap);
return;
* autoindent. The insert command depends on being on the last
* character of a line or not.
*/
-#ifdef FEAT_MBYTE
(void)del_chars(cap->count1, FALSE); /* delete the characters */
-#else
- (void)del_bytes(cap->count1, FALSE, FALSE); /* delete the characters */
-#endif
stuffcharReadbuff('\r');
stuffcharReadbuff(ESC);
NUL, 'r', NUL, had_ctrl_v, cap->nchar);
curbuf->b_op_start = curwin->w_cursor;
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
int old_State = State;
}
}
else
-#endif
{
/*
* Replace the characters within one line.
(colnr_T)(curwin->w_cursor.col - cap->count1));
}
--curwin->w_cursor.col; /* cursor on the last replaced char */
-#ifdef FEAT_MBYTE
/* if the character on the left of the current cursor is a multi-byte
* character, move two characters left */
if (has_mbyte)
mb_adjust_cursor();
-#endif
curbuf->b_op_end = curwin->w_cursor;
curwin->w_set_curswant = TRUE;
set_last_insert(cap->nchar);
validate_virtcol();
curwin->w_curswant = curwin->w_virtcol;
curwin->w_set_curswant = FALSE;
-#if defined(FEAT_LINEBREAK) || defined(FEAT_MBYTE)
if (curwin->w_cursor.col > 0 && curwin->w_p_wrap)
{
/*
if (curwin->w_virtcol > (colnr_T)i)
--curwin->w_cursor.col;
}
-#endif
}
else if (nv_screengo(oap, FORWARD, cap->count1 - 1) == FAIL)
clearopbeep(oap);
do_ascii(NULL);
break;
-#ifdef FEAT_MBYTE
/*
* "g8": Display the bytes used for the UTF-8 character under the
* cursor. It is displayed in hex.
else
show_utf8();
break;
-#endif
/* "g<": show scrollback text */
case '<':
)
{
--curwin->w_cursor.col;
-#ifdef FEAT_MBYTE
/* prevent cursor from moving on the trail byte */
if (has_mbyte)
mb_adjust_cursor();
-#endif
oap->inclusive = TRUE;
}
}
if (VIsual_active && cap->oap->inclusive && *p_sel == 'e'
&& gchar_cursor() != NUL && LT_POS(VIsual, curwin->w_cursor))
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
inc_cursor();
else
-#endif
++curwin->w_cursor.col;
cap->oap->inclusive = FALSE;
}
if (pp->col > 0)
{
--pp->col;
-#ifdef FEAT_MBYTE
mb_adjustpos(curbuf, pp);
-#endif
}
else if (pp->lnum > 1)
{
oap->block_mode = TRUE;
-#ifdef FEAT_MBYTE
/* prevent from moving onto a trail byte */
if (has_mbyte)
mb_adjustpos(curwin->w_buffer, &oap->end);
-#endif
getvvcol(curwin, &(oap->start), &oap->start_vcol, NULL, &oap->end_vcol);
static int put_in_typebuf(char_u *s, int esc, int colon,
int silent);
static void stuffescaped(char_u *arg, int literally);
-#ifdef FEAT_MBYTE
static void mb_adjust_opend(oparg_T *oap);
-#endif
static void free_yank_all(void);
static int yank_copy_line(struct block_def *bd, long y_idx);
#ifdef FEAT_CLIPBOARD
ws_vcol = bd.start_vcol - bd.pre_whitesp;
if (bd.startspaces)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
if ((*mb_ptr2len)(bd.textstart) == 1)
}
}
else
-#endif
++bd.textstart;
}
for ( ; VIM_ISWHITE(*bd.textstart); )
}
}
-#ifdef FEAT_MBYTE
if (has_mbyte && spaces > 0)
{
int off;
spaces -= off;
count -= off;
}
-#endif
newp = alloc_check((unsigned)(STRLEN(oldp)) + s_len + count + 1);
if (newp == NULL)
/* stuff a single special character */
if (*arg != NUL)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
c = mb_cptr2char_adv(&arg);
else
-#endif
c = *arg++;
if (literally && ((c < ' ' && c != TAB) || c == DEL))
stuffcharReadbuff(Ctrl_V);
adjust_clip_reg(&oap->regname);
#endif
-#ifdef FEAT_MBYTE
if (has_mbyte)
mb_adjust_opend(oap);
-#endif
/*
* Imitate the strange Vi behaviour: If the delete spans more than one
return OK;
}
-#ifdef FEAT_MBYTE
/*
* Adjust end of operating area for ending on a multi-byte character.
* Used for deletion.
oap->end.col += mb_tail_off(p, p + oap->end.col);
}
}
-#endif
-
-#ifdef FEAT_MBYTE
/*
* Replace the character under the cursor with "c".
* This takes care of multi-byte characters.
/* Backup to the replaced character. */
dec_cursor();
}
-#endif
/*
* Replace a whole area with one character.
op_replace(oparg_T *oap, int c)
{
int n, numc;
-#ifdef FEAT_MBYTE
int num_chars;
-#endif
char_u *newp, *oldp;
size_t oldlen;
struct block_def bd;
c = NL;
}
-#ifdef FEAT_MBYTE
if (has_mbyte)
mb_adjust_opend(oap);
-#endif
if (u_save((linenr_T)(oap->start.lnum - 1),
(linenr_T)(oap->end.lnum + 1)) == FAIL)
if (bd.is_short && (!virtual_op || bd.is_MAX))
numc -= (oap->end_vcol - bd.end_vcol) + 1;
-#ifdef FEAT_MBYTE
/* A double-wide character can be replaced only up to half the
* times. */
if ((*mb_char2cells)(c) > 1)
/* Compute bytes needed, move character count to num_chars. */
num_chars = numc;
numc *= (*mb_char2len)(c);
-#endif
/* oldlen includes textlen, so don't double count */
n += numc - bd.textlen;
* literally. */
if (had_ctrl_v_cr || (c != '\r' && c != '\n'))
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
n = (int)STRLEN(newp);
n += (*mb_char2bytes)(c, newp + n);
}
else
-#endif
vim_memset(newp + STRLEN(newp), c, (size_t)numc);
if (!bd.is_short)
{
n = gchar_cursor();
if (n != NUL)
{
-#ifdef FEAT_MBYTE
if ((*mb_char2len)(c) > 1 || (*mb_char2len)(n) > 1)
{
/* This is slow, but it handles replacing a single-byte
replace_character(c);
}
else
-#endif
{
#ifdef FEAT_VIRTUALEDIT
if (n == TAB)
curwin->w_cursor.col -= (virtcols + 1);
for (; virtcols >= 0; virtcols--)
{
-# ifdef FEAT_MBYTE
if ((*mb_char2len)(c) > 1)
replace_character(c);
else
-# endif
PBYTE(curwin->w_cursor, c);
if (inc(&curwin->w_cursor) == -1)
break;
for (todo = length; todo > 0; --todo)
{
-# ifdef FEAT_MBYTE
if (has_mbyte)
{
int len = (*mb_ptr2len)(ml_get_pos(pos));
if (len > 0)
todo -= len - 1;
}
-# endif
did_change |= swapchar(op_type, pos);
if (inc(pos) == -1) /* at end of file */
break;
if (c >= 0x80 && op_type == OP_ROT13)
return FALSE;
-#ifdef FEAT_MBYTE
if (op_type == OP_UPPER && c == 0xdf
&& (enc_latin1like || STRCMP(p_enc, "iso-8859-2") == 0))
{
if (enc_dbcs != 0 && c >= 0x100) /* No lower/uppercase letter */
return FALSE;
-#endif
nc = c;
if (MB_ISLOWER(c))
{
}
if (nc != c)
{
-#ifdef FEAT_MBYTE
if (enc_utf8 && (c >= 0x80 || nc >= 0x80))
{
pos_T sp = curwin->w_cursor;
curwin->w_cursor = sp;
}
else
-#endif
PBYTE(*pos, nc);
return TRUE;
}
{
getvcol(curwin, &oap->end, &cs, NULL, &ce);
if (p[endcol] == NUL || (cs + oap->end.coladd < ce
-# ifdef FEAT_MBYTE
/* Don't add space for double-wide
* char; endcol will be on last byte
* of multi-byte char. */
- && (*mb_head_off)(p, p + endcol) == 0
-# endif
- ))
+ && (*mb_head_off)(p, p + endcol) == 0))
{
if (oap->start.lnum == oap->end.lnum
&& oap->start.col == oap->end.col)
#endif
getvcol(curwin, &curwin->w_cursor, NULL, NULL, &col);
-#ifdef FEAT_MBYTE
if (has_mbyte)
/* move to start of next multi-byte character */
curwin->w_cursor.col += (*mb_ptr2len)(ml_get_cursor());
else
-#endif
#ifdef FEAT_VIRTUALEDIT
if (c != TAB || ve_flags != VE_ALL)
#endif
bd.startspaces = incr - bd.endspaces;
--bd.textcol;
delcount = 1;
-#ifdef FEAT_MBYTE
if (has_mbyte)
bd.textcol -= (*mb_head_off)(oldp, oldp + bd.textcol);
-#endif
if (oldp[bd.textcol] != TAB)
{
/* Only a Tab can be split into spaces. Other
* char */
if (dir == FORWARD && gchar_cursor() != NUL)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
int bytelen = (*mb_ptr2len)(ml_get_cursor());
}
}
else
-#endif
{
++col;
if (yanklen)
int name;
int attr;
char_u *arg = eap->arg;
-#ifdef FEAT_MBYTE
int clen;
-#else
-# define clen 1
-#endif
if (arg != NULL && *arg == NUL)
arg = NULL;
}
for (p = yb->y_array[j]; *p && (n -= ptr2cells(p)) >= 0; ++p)
{
-#ifdef FEAT_MBYTE
clen = (*mb_ptr2len)(p);
-#endif
msg_outtrans_len(p, clen);
-#ifdef FEAT_MBYTE
p += clen - 1;
-#endif
}
}
if (n > 1 && yb->y_type == MLINE)
int skip_esc) /* if TRUE, ignore trailing ESC */
{
int n;
-#ifdef FEAT_MBYTE
int l;
-#endif
n = (int)Columns - 6;
while (*p != NUL
&& !(*p == ESC && skip_esc && *(p + 1) == NUL)
&& (n -= ptr2cells(p)) >= 0)
{
-#ifdef FEAT_MBYTE
if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
{
msg_outtrans_len(p, l);
p += l;
}
else
-#endif
msg_outtrans_len(p++, 1);
}
ui_breakcheck();
{
curr = skipwhite(curr);
if (*curr != ')' && currsize != 0 && endcurr1 != TAB
-#ifdef FEAT_MBYTE
&& (!has_format_option(FO_MBYTE_JOIN)
|| (mb_ptr2char(curr) < 0x100 && endcurr1 < 0x100))
&& (!has_format_option(FO_MBYTE_JOIN2)
|| mb_ptr2char(curr) < 0x100 || endcurr1 < 0x100)
-#endif
)
{
/* don't add a space if the line is ending in a space */
endcurr1 = endcurr2 = NUL;
if (insert_space && currsize > 0)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
cend = curr + currsize;
}
}
else
-#endif
{
endcurr1 = *(curr + currsize - 1);
if (currsize > 1)
while (col > 0 && vim_isbdigit(ptr[col]))
{
--col;
-#ifdef FEAT_MBYTE
if (has_mbyte)
col -= (*mb_head_off)(ptr, ptr + col);
-#endif
}
if (dohex)
while (col > 0 && vim_isxdigit(ptr[col]))
{
--col;
-#ifdef FEAT_MBYTE
if (has_mbyte)
col -= (*mb_head_off)(ptr, ptr + col);
-#endif
}
if ( dobin
&& (ptr[col] == 'X'
|| ptr[col] == 'x')
&& ptr[col - 1] == '0'
-#ifdef FEAT_MBYTE
&& (!has_mbyte ||
!(*mb_head_off)(ptr, ptr + col - 1))
-#endif
&& vim_isxdigit(ptr[col + 1]))))
{
while (col > 0 && vim_isdigit(ptr[col]))
{
col--;
-#ifdef FEAT_MBYTE
if (has_mbyte)
col -= (*mb_head_off)(ptr, ptr + col);
-#endif
}
}
&& (ptr[col] == 'X'
|| ptr[col] == 'x')
&& ptr[col - 1] == '0'
-#ifdef FEAT_MBYTE
&& (!has_mbyte ||
!(*mb_head_off)(ptr, ptr + col - 1))
-#endif
&& vim_isxdigit(ptr[col + 1])) ||
( dobin
&& col > 0
&& (ptr[col] == 'B'
|| ptr[col] == 'b')
&& ptr[col - 1] == '0'
-#ifdef FEAT_MBYTE
&& (!has_mbyte ||
!(*mb_head_off)(ptr, ptr + col - 1))
-#endif
&& vim_isbdigit(ptr[col + 1])))
{
/* Found hexadecimal or binary number, move to its start. */
--col;
-#ifdef FEAT_MBYTE
if (has_mbyte)
col -= (*mb_head_off)(ptr, ptr + col);
-#endif
}
else
{
&& !(doalp && ASCII_ISALPHA(ptr[col])))
{
--col;
-#ifdef FEAT_MBYTE
if (has_mbyte)
col -= (*mb_head_off)(ptr, ptr + col);
-#endif
}
}
}
goto theend;
if (col > pos->col && ptr[col - 1] == '-'
-#ifdef FEAT_MBYTE
- && (!has_mbyte ||
- !(*mb_head_off)(ptr, ptr + col - 1))
-#endif
- )
+ && (!has_mbyte || !(*mb_head_off)(ptr, ptr + col - 1)))
{
negative = TRUE;
was_positive = FALSE;
else
{
if (col > 0 && ptr[col - 1] == '-'
-#ifdef FEAT_MBYTE
&& (!has_mbyte ||
!(*mb_head_off)(ptr, ptr + col - 1))
-#endif
&& !visual)
{
/* negative number */
if (dpy != NULL && str != NULL && motion_type >= 0
&& len < 1024*1024 && len > 0)
{
-#ifdef FEAT_MBYTE
int ok = TRUE;
/* The CUT_BUFFER0 is supposed to always contain latin1. Convert from
/* Do not store the string if conversion failed. Better to use any
* other selection than garbled text. */
if (ok)
-#endif
{
XStoreBuffer(dpy, (char *)str, (int)len, 0);
XFlush(dpy);
else if (!vim_isspace(line[i]))
is_word = 1;
++chars;
-#ifdef FEAT_MBYTE
i += (*mb_ptr2len)(line + i);
-#else
- ++i;
-#endif
}
if (is_word)
char_u buf2[40];
linenr_T lnum;
varnumber_T byte_count = 0;
-#ifdef FEAT_MBYTE
varnumber_T bom_count = 0;
-#endif
varnumber_T byte_count_cursor = 0;
varnumber_T char_count = 0;
varnumber_T char_count_cursor = 0;
}
}
-#ifdef FEAT_MBYTE
bom_count = bomb_size();
if (bom_count > 0)
vim_snprintf((char *)IObuff + STRLEN(IObuff), IOSIZE,
- _("(+%lld for BOM)"), (long_long_T)bom_count);
-#endif
+ _("(+%lld for BOM)"), (long_long_T)bom_count);
if (dict == NULL)
{
/* Don't shorten this message, the user asked for it. */
{
dict_add_number(dict, "words", word_count);
dict_add_number(dict, "chars", char_count);
- dict_add_number(dict, "bytes", byte_count
-# ifdef FEAT_MBYTE
- + bom_count
-# endif
- );
+ dict_add_number(dict, "bytes", byte_count + bom_count);
dict_add_number(dict, VIsual_active ? "visual_bytes" : "cursor_bytes",
byte_count_cursor);
dict_add_number(dict, VIsual_active ? "visual_chars" : "cursor_chars",
#endif
#define PV_BIN OPT_BUF(BV_BIN)
#define PV_BL OPT_BUF(BV_BL)
-#ifdef FEAT_MBYTE
-# define PV_BOMB OPT_BUF(BV_BOMB)
-#endif
+#define PV_BOMB OPT_BUF(BV_BOMB)
#define PV_CI OPT_BUF(BV_CI)
#ifdef FEAT_CINDENT
# define PV_CIN OPT_BUF(BV_CIN)
#define PV_FIXEOL OPT_BUF(BV_FIXEOL)
#define PV_EP OPT_BOTH(OPT_BUF(BV_EP))
#define PV_ET OPT_BUF(BV_ET)
-#ifdef FEAT_MBYTE
-# define PV_FENC OPT_BUF(BV_FENC)
-#endif
+#define PV_FENC OPT_BUF(BV_FENC)
#if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
# define PV_BEXPR OPT_BOTH(OPT_BUF(BV_BEXPR))
#endif
# define PV_LISP OPT_BUF(BV_LISP)
# define PV_LW OPT_BOTH(OPT_BUF(BV_LW))
#endif
-#ifdef FEAT_MBYTE
-# define PV_MENC OPT_BOTH(OPT_BUF(BV_MENC))
-#endif
+#define PV_MENC OPT_BOTH(OPT_BUF(BV_MENC))
#define PV_MA OPT_BUF(BV_MA)
#define PV_ML OPT_BUF(BV_ML)
#define PV_MOD OPT_BUF(BV_MOD)
*/
static int p_ai;
static int p_bin;
-#ifdef FEAT_MBYTE
static int p_bomb;
-#endif
static char_u *p_bh;
static char_u *p_bt;
static int p_bl;
static int p_eol;
static int p_fixeol;
static int p_et;
-#ifdef FEAT_MBYTE
static char_u *p_fenc;
-#endif
static char_u *p_ff;
static char_u *p_fo;
static char_u *p_flp;
#endif
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
{"ambiwidth", "ambw", P_STRING|P_VI_DEF|P_RCLR,
-#if defined(FEAT_MBYTE)
(char_u *)&p_ambw, PV_NONE,
{(char_u *)"single", (char_u *)0L}
-#else
- (char_u *)NULL, PV_NONE,
- {(char_u *)0L, (char_u *)0L}
-#endif
SCTX_INIT},
{"autochdir", "acd", P_BOOL|P_VI_DEF,
#ifdef FEAT_AUTOCHDIR
(char_u *)NULL, PV_NONE,
{(char_u *)TRUE, (char_u *)0L} SCTX_INIT},
{"bomb", NULL, P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
-#ifdef FEAT_MBYTE
(char_u *)&p_bomb, PV_BOMB,
-#else
- (char_u *)NULL, PV_NONE,
-#endif
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
{"breakat", "brk", P_STRING|P_VI_DEF|P_RALL|P_FLAGLIST,
#ifdef FEAT_LINEBREAK
{(char_u *)"", (char_u *)0L}
SCTX_INIT},
{"casemap", "cmp", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP,
-#ifdef FEAT_MBYTE
(char_u *)&p_cmp, PV_NONE,
{(char_u *)"internal,keepascii", (char_u *)0L}
-#else
- (char_u *)NULL, PV_NONE,
- {(char_u *)0L, (char_u *)0L}
-#endif
SCTX_INIT},
{"cdpath", "cd", P_STRING|P_EXPAND|P_VI_DEF|P_COMMA|P_NODUP,
#ifdef FEAT_SEARCHPATH
#endif
SCTX_INIT},
{"charconvert", "ccv", P_STRING|P_VI_DEF|P_SECURE,
-#if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
+#if defined(FEAT_EVAL)
(char_u *)&p_ccv, PV_NONE,
{(char_u *)"", (char_u *)0L}
#else
#endif
SCTX_INIT},
{"delcombine", "deco", P_BOOL|P_VI_DEF|P_VIM,
-#ifdef FEAT_MBYTE
(char_u *)&p_deco, PV_NONE,
-#else
- (char_u *)NULL, PV_NONE,
-#endif
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
{"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP|P_NDNAME,
#ifdef FEAT_INS_EXPAND
(char_u *)&p_ed, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
{"emoji", "emo", P_BOOL|P_VI_DEF|P_RCLR,
-#if defined(FEAT_MBYTE)
(char_u *)&p_emoji, PV_NONE,
{(char_u *)TRUE, (char_u *)0L}
-#else
- (char_u *)NULL, PV_NONE,
- {(char_u *)0L, (char_u *)0L}
-#endif
SCTX_INIT},
{"encoding", "enc", P_STRING|P_VI_DEF|P_RCLR|P_NO_ML,
-#ifdef FEAT_MBYTE
(char_u *)&p_enc, PV_NONE,
{(char_u *)ENC_DFLT, (char_u *)0L}
-#else
- (char_u *)NULL, PV_NONE,
- {(char_u *)0L, (char_u *)0L}
-#endif
SCTX_INIT},
{"endofline", "eol", P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT,
(char_u *)&p_eol, PV_EOL,
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
{"fileencoding","fenc", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_RBUF
|P_NO_MKRC,
-#ifdef FEAT_MBYTE
(char_u *)&p_fenc, PV_FENC,
{(char_u *)"", (char_u *)0L}
-#else
- (char_u *)NULL, PV_NONE,
- {(char_u *)0L, (char_u *)0L}
-#endif
SCTX_INIT},
{"fileencodings","fencs", P_STRING|P_VI_DEF|P_ONECOMMA,
-#ifdef FEAT_MBYTE
(char_u *)&p_fencs, PV_NONE,
{(char_u *)"ucs-bom", (char_u *)0L}
-#else
- (char_u *)NULL, PV_NONE,
- {(char_u *)0L, (char_u *)0L}
-#endif
SCTX_INIT},
{"fileformat", "ff", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_NO_MKRC
|P_CURSWANT,
#endif
SCTX_INIT},
{"guifontwide", "gfw", P_STRING|P_VI_DEF|P_RCLR|P_ONECOMMA|P_NODUP,
-#if defined(FEAT_GUI) && defined(FEAT_MBYTE)
+#if defined(FEAT_GUI)
(char_u *)&p_guifontwide, PV_NONE,
{(char_u *)"", (char_u *)0L}
#else
(char_u *)&p_ic, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
{"imactivatefunc","imaf",P_STRING|P_VI_DEF|P_SECURE,
-#if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
+#if defined(FEAT_EVAL)
(char_u *)&p_imaf, PV_NONE,
{(char_u *)"", (char_u *)NULL}
# else
#endif
{(char_u *)"", (char_u *)0L} SCTX_INIT},
{"imcmdline", "imc", P_BOOL|P_VI_DEF,
-#ifdef FEAT_MBYTE
(char_u *)&p_imcmdline, PV_NONE,
-#else
- (char_u *)NULL, PV_NONE,
-#endif
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
{"imdisable", "imd", P_BOOL|P_VI_DEF,
-#ifdef FEAT_MBYTE
(char_u *)&p_imdisable, PV_NONE,
-#else
- (char_u *)NULL, PV_NONE,
-#endif
#ifdef __sgi
{(char_u *)TRUE, (char_u *)0L}
#else
{(char_u *)B_IMODE_USE_INSERT, (char_u *)0L}
SCTX_INIT},
{"imstatusfunc","imsf",P_STRING|P_VI_DEF|P_SECURE,
-#if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
+#if defined(FEAT_EVAL)
(char_u *)&p_imsf, PV_NONE,
{(char_u *)"", (char_u *)NULL}
#else
#endif
SCTX_INIT},
{"makeencoding","menc", P_STRING|P_VI_DEF,
-#ifdef FEAT_MBYTE
(char_u *)&p_menc, PV_MENC,
{(char_u *)"", (char_u *)0L}
-#else
- (char_u *)NULL, PV_NONE,
- {(char_u *)0L, (char_u *)0L}
-#endif
SCTX_INIT},
{"makeprg", "mp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
#ifdef FEAT_QUICKFIX
(char_u *)&p_mat, PV_NONE,
{(char_u *)5L, (char_u *)0L} SCTX_INIT},
{"maxcombine", "mco", P_NUM|P_VI_DEF|P_CURSWANT,
-#ifdef FEAT_MBYTE
(char_u *)&p_mco, PV_NONE,
-#else
- (char_u *)NULL, PV_NONE,
-#endif
{(char_u *)2, (char_u *)0L} SCTX_INIT},
{"maxfuncdepth", "mfd", P_NUM|P_VI_DEF,
#ifdef FEAT_EVAL
#endif
SCTX_INIT},
{"printmbcharset", "pmbcs", P_STRING|P_VI_DEF,
-#if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
+#if defined(FEAT_POSTSCRIPT)
(char_u *)&p_pmcs, PV_NONE,
{(char_u *)"", (char_u *)0L}
#else
#endif
SCTX_INIT},
{"printmbfont", "pmbfn", P_STRING|P_VI_DEF,
-#if defined(FEAT_POSTSCRIPT) && defined(FEAT_MBYTE)
+#if defined(FEAT_POSTSCRIPT)
(char_u *)&p_pmfn, PV_NONE,
{(char_u *)"", (char_u *)0L}
#else
#endif
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
{"termencoding", "tenc", P_STRING|P_VI_DEF|P_RCLR,
-#ifdef FEAT_MBYTE
(char_u *)&p_tenc, PV_NONE,
{(char_u *)"", (char_u *)0L}
-#else
- (char_u *)NULL, PV_NONE,
- {(char_u *)0L, (char_u *)0L}
-#endif
SCTX_INIT},
{"termguicolors", "tgc", P_BOOL|P_VI_DEF|P_VIM|P_RCLR,
#ifdef FEAT_TERMGUICOLORS
#define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption))
-#ifdef FEAT_MBYTE
static char *(p_ambw_values[]) = {"single", "double", NULL};
-#endif
static char *(p_bg_values[]) = {"light", "dark", NULL};
static char *(p_nf_values[]) = {"bin", "octal", "hex", "alpha", NULL};
static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL};
didset_options2();
-#ifdef FEAT_MBYTE
# if defined(WIN3264) && defined(FEAT_GETTEXT)
/*
* If $LANG isn't set, try to get a good value for it. This makes the
}
#endif
-# if defined(WIN3264) && !defined(FEAT_GUI)
+#if defined(WIN3264) && !defined(FEAT_GUI)
/* Win32 console: When GetACP() returns a different value from
* GetConsoleCP() set 'termencoding'. */
if (GetACP() != GetConsoleCP())
else
p_tenc = empty_option;
}
-# endif
-# if defined(WIN3264) && defined(FEAT_MBYTE)
+#endif
+#if defined(WIN3264)
/* $HOME may have characters in active code page. */
init_homedir();
-# endif
+#endif
}
else
{
p_enc = save_enc;
}
}
-#endif
#ifdef FEAT_MULTI_LANG
/* Set the default for 'helplang'. */
for (i = 0; !istermoption(&options[i]); i++)
if (!(options[i].flags & P_NODEFAULT)
-#if defined(FEAT_MBYTE) || defined(FEAT_CRYPT)
&& (opt_flags == 0
- || (TRUE
-# if defined(FEAT_MBYTE)
- && options[i].var != (char_u *)&p_enc
-# endif
+ || (options[i].var != (char_u *)&p_enc
# if defined(FEAT_CRYPT)
&& options[i].var != (char_u *)&p_cm
&& options[i].var != (char_u *)&p_key
# endif
- ))
-#endif
- )
+ )))
set_option_default(i, opt_flags, p_cp);
/* The 'scroll' option must be computed for all windows. */
#endif
)
++arg; /* remove backslash */
-#ifdef FEAT_MBYTE
if (has_mbyte
&& (i = (*mb_ptr2len)(arg)) > 1)
{
s += i;
}
else
-#endif
*s++ = *arg++;
}
*s = NUL;
/* initialize the table for 'iskeyword' et.al. */
(void)init_chartab();
-#ifdef FEAT_MBYTE
(void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE);
-#endif
(void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE);
(void)opt_strings_flags(p_bo, p_bo_values, &bo_flags, TRUE);
#ifdef FEAT_SESSION
{
check_string_option(&buf->b_p_bh);
check_string_option(&buf->b_p_bt);
-#ifdef FEAT_MBYTE
check_string_option(&buf->b_p_fenc);
-#endif
check_string_option(&buf->b_p_ff);
#ifdef FEAT_FIND_ID
check_string_option(&buf->b_p_def);
check_string_option(&buf->b_p_lw);
#endif
check_string_option(&buf->b_p_bkc);
-#ifdef FEAT_MBYTE
check_string_option(&buf->b_p_menc);
-#endif
#ifdef FEAT_VARTABS
check_string_option(&buf->b_p_vsts);
check_string_option(&buf->b_p_vts);
}
/* 'ambiwidth' */
-#ifdef FEAT_MBYTE
else if (varp == &p_ambw || varp == &p_emoji)
{
if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
else if (set_chars_option(&p_fcs) != NULL)
errmsg = _("E835: Conflicts with value of 'fillchars'");
}
-#endif
/* 'background' */
else if (varp == &p_bg)
errmsg = e_invarg;
}
-#ifdef FEAT_MBYTE
/* 'encoding', 'fileencoding', 'termencoding' and 'makeencoding' */
else if (varp == &p_enc || gvarp == &p_fenc || varp == &p_tenc
|| gvarp == &p_menc)
errmsg = e_invarg;
else
{
-# ifdef FEAT_TITLE
+#ifdef FEAT_TITLE
/* May show a "+" in the title now. */
redraw_titles();
-# endif
+#endif
/* Add 'fileencoding' to the swap file. */
ml_setflags(curbuf);
}
if (varp == &p_enc)
{
errmsg = mb_init();
-# ifdef FEAT_TITLE
+#ifdef FEAT_TITLE
redraw_titles();
-# endif
+#endif
}
}
-# if defined(FEAT_GUI_GTK)
+#if defined(FEAT_GUI_GTK)
if (errmsg == NULL && varp == &p_tenc && gui.in_use)
{
/* GTK+ 2 uses only a single encoding, and that is UTF-8. */
if (STRCMP(p_tenc, "utf-8") != 0)
errmsg = N_("E617: Cannot be changed in the GTK+ 2 GUI");
}
-# endif
+#endif
if (errmsg == NULL)
{
-# ifdef FEAT_KEYMAP
+#ifdef FEAT_KEYMAP
/* When 'keymap' is used and 'encoding' changes, reload the keymap
* (with another encoding). */
if (varp == &p_enc && *curbuf->b_p_keymap != NUL)
(void)keymap_init();
-# endif
+#endif
/* When 'termencoding' is not empty and 'encoding' changes or when
* 'termencoding' changes, need to setup for keyboard input and
}
}
-# if defined(WIN3264) && defined(FEAT_MBYTE)
+#if defined(WIN3264)
/* $HOME may have characters in active code page. */
if (varp == &p_enc)
init_homedir();
-# endif
+#endif
}
}
-#endif
#if defined(FEAT_POSTSCRIPT)
else if (varp == &p_penc)
/* 'matchpairs' */
else if (gvarp == &p_mps)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
for (p = *varp; *p != NUL; ++p)
}
}
else
-#endif
{
/* Check for "x:y,x:y" */
for (p = *varp; *p != NUL; p += 4)
redraw_gui_only = TRUE;
}
# endif
-# ifdef FEAT_MBYTE
else if (varp == &p_guifontwide)
{
if (STRCMP(p_guifontwide, "*") == 0)
errmsg = N_("E534: Invalid wide font");
redraw_gui_only = TRUE;
}
-# endif
#endif
#ifdef CURSOR_SHAPE
#ifdef FEAT_PRINTER
else if (varp == &p_popt)
errmsg = parse_printoptions();
-# if defined(FEAT_MBYTE) && defined(FEAT_POSTSCRIPT)
+# if defined(FEAT_POSTSCRIPT)
else if (varp == &p_pmfn)
errmsg = parse_printmbfont();
# endif
errmsg = e_invarg;
}
-#ifdef FEAT_MBYTE
/* 'casemap' */
else if (varp == &p_cmp)
{
if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, TRUE) != OK)
errmsg = e_invarg;
}
-#endif
#ifdef FEAT_DIFF
/* 'diffopt' */
{
c1 = c2 = c3 = 0;
s = p + len + 1;
-#ifdef FEAT_MBYTE
c1 = mb_ptr2char_adv(&s);
if (mb_char2cells(c1) > 1)
continue;
-#else
- c1 = *s++;
-#endif
if (tab[i].cp == &lcs_tab2)
{
if (*s == NUL)
continue;
-#ifdef FEAT_MBYTE
c2 = mb_ptr2char_adv(&s);
if (mb_char2cells(c2) > 1)
continue;
-#else
- c2 = *s++;
-#endif
if (!(*s == ',' || *s == NUL))
{
-#ifdef FEAT_MBYTE
c3 = mb_ptr2char_adv(&s);
if (mb_char2cells(c3) > 1)
continue;
-#else
- c3 = *s++;
-#endif
}
}
{
redraw_titles();
}
-# ifdef FEAT_MBYTE
/* when 'bomb' is changed, redraw the window title and tab page text */
else if ((int *)varp == &curbuf->b_p_bomb)
{
redraw_titles();
}
-# endif
#endif
/* when 'bin' is set also set some other options */
#endif
}
-# ifdef FEAT_MBYTE
/* set 'delcombine' */
p_deco = TRUE;
-# endif
# ifdef FEAT_KEYMAP
/* Force-set the necessary keymap for arabic */
}
#endif
-#ifdef FEAT_MBYTE
/* 'maxcombine' */
else if (pp == &p_mco)
{
p_mco = 0;
screenclear(); /* will re-allocate the screen */
}
-#endif
else if (pp == &curbuf->b_p_iminsert)
{
return (char_u *)NULL;
}
-#if defined(FEAT_MBYTE) || defined(PROTO)
char_u *
get_encoding_default(void)
{
return options[i].def_val[VI_DEFAULT];
return (char_u *)NULL;
}
-#endif
/*
* Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number.
clear_string_option(&buf->b_p_lw);
break;
#endif
-#ifdef FEAT_MBYTE
case PV_MENC:
clear_string_option(&buf->b_p_menc);
break;
-#endif
}
}
#endif
case PV_LW: return (char_u *)&(curbuf->b_p_lw);
#endif
case PV_BKC: return (char_u *)&(curbuf->b_p_bkc);
-#ifdef FEAT_MBYTE
case PV_MENC: return (char_u *)&(curbuf->b_p_menc);
-#endif
}
return NULL; /* "cannot happen" */
}
case PV_LW: return *curbuf->b_p_lw != NUL
? (char_u *)&(curbuf->b_p_lw) : p->var;
#endif
-#ifdef FEAT_MBYTE
case PV_MENC: return *curbuf->b_p_menc != NUL
? (char_u *)&(curbuf->b_p_menc) : p->var;
-#endif
#ifdef FEAT_ARABIC
case PV_ARAB: return (char_u *)&(curwin->w_p_arab);
case PV_AI: return (char_u *)&(curbuf->b_p_ai);
case PV_BIN: return (char_u *)&(curbuf->b_p_bin);
-#ifdef FEAT_MBYTE
case PV_BOMB: return (char_u *)&(curbuf->b_p_bomb);
-#endif
case PV_BH: return (char_u *)&(curbuf->b_p_bh);
case PV_BT: return (char_u *)&(curbuf->b_p_bt);
case PV_BL: return (char_u *)&(curbuf->b_p_bl);
case PV_EOL: return (char_u *)&(curbuf->b_p_eol);
case PV_FIXEOL: return (char_u *)&(curbuf->b_p_fixeol);
case PV_ET: return (char_u *)&(curbuf->b_p_et);
-#ifdef FEAT_MBYTE
case PV_FENC: return (char_u *)&(curbuf->b_p_fenc);
-#endif
case PV_FF: return (char_u *)&(curbuf->b_p_ff);
case PV_FT: return (char_u *)&(curbuf->b_p_ft);
case PV_FO: return (char_u *)&(curbuf->b_p_fo);
free_buf_options(buf, TRUE);
buf->b_p_ro = FALSE; /* don't copy readonly */
buf->b_p_tx = p_tx;
-#ifdef FEAT_MBYTE
buf->b_p_fenc = vim_strsave(p_fenc);
-#endif
switch (*p_ffs)
{
case 'm':
buf->b_p_wm_nopaste = p_wm_nopaste;
buf->b_p_wm_nobin = p_wm_nobin;
buf->b_p_bin = p_bin;
-#ifdef FEAT_MBYTE
buf->b_p_bomb = p_bomb;
-#endif
buf->b_p_fixeol = p_fixeol;
buf->b_p_et = p_et;
buf->b_p_et_nobin = p_et_nobin;
#ifdef FEAT_LISP
buf->b_p_lw = empty_option;
#endif
-#ifdef FEAT_MBYTE
buf->b_p_menc = empty_option;
-#endif
/*
* Don't copy the options set by ex_help(), use the saved values,
*
* langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim
* commands.
- * When FEAT_MBYTE is defined langmap_mapga.ga_data is a sorted table of
- * langmap_entry_T. This does the same as langmap_mapchar[] for characters >=
- * 256.
- */
-# if defined(FEAT_MBYTE) || defined(PROTO)
-/*
- * With multi-byte support use growarray for 'langmap' chars >= 256
+ * langmap_mapga.ga_data is a sorted table of langmap_entry_T. This does the
+ * same as langmap_mapchar[] for characters >= 256.
+ *
+ * Use growarray for 'langmap' chars >= 256
*/
typedef struct
{
}
return c; /* no entry found, return "c" unmodified */
}
-# endif
static void
langmap_init(void)
for (i = 0; i < 256; i++)
langmap_mapchar[i] = i; /* we init with a one-to-one map */
-# ifdef FEAT_MBYTE
ga_init2(&langmap_mapga, sizeof(langmap_entry_T), 8);
-# endif
}
/*
char_u *p2;
int from, to;
-#ifdef FEAT_MBYTE
ga_clear(&langmap_mapga); /* clear the previous map first */
-#endif
langmap_init(); /* back to one-to-one map */
for (p = p_langmap; p[0] != NUL; )
}
if (p[0] == '\\' && p[1] != NUL)
++p;
-#ifdef FEAT_MBYTE
from = (*mb_ptr2char)(p);
-#else
- from = p[0];
-#endif
to = NUL;
if (p2 == NULL)
{
{
if (p[0] == '\\')
++p;
-#ifdef FEAT_MBYTE
to = (*mb_ptr2char)(p);
-#else
- to = p[0];
-#endif
}
}
else
{
if (p2[0] == '\\')
++p2;
-#ifdef FEAT_MBYTE
to = (*mb_ptr2char)(p2);
-#else
- to = p2[0];
-#endif
}
}
if (to == NUL)
return;
}
-#ifdef FEAT_MBYTE
if (from >= 256)
langmap_set_entry(from, to);
else
-#endif
langmap_mapchar[from & 255] = to;
/* Advance to next pair */
{
buf->b_start_ffc = *buf->b_p_ff;
buf->b_start_eol = buf->b_p_eol;
-#ifdef FEAT_MBYTE
buf->b_start_bomb = buf->b_p_bomb;
/* Only use free/alloc when necessary, they take time. */
vim_free(buf->b_start_fenc);
buf->b_start_fenc = vim_strsave(buf->b_p_fenc);
}
-#endif
}
/*
return TRUE;
if ((buf->b_p_bin || !buf->b_p_fixeol) && buf->b_start_eol != buf->b_p_eol)
return TRUE;
-#ifdef FEAT_MBYTE
if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb)
return TRUE;
if (buf->b_start_fenc == NULL)
return (*buf->b_p_fenc != NUL);
return (STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0);
-#else
- return FALSE;
-#endif
}
/*
ptr = curbuf->b_p_mps;
while (*ptr != NUL)
{
-#ifdef FEAT_MBYTE
if (has_mbyte)
{
char_u *prev;
ptr += mb_ptr2len(ptr);
}
else
-#endif
{
if (*ptr == *initc)
{
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 806,
/**/
805,
/**/