mirror of
https://github.com/zoriya/vim.git
synced 2025-12-20 14:15:18 +00:00
patch 8.1.0809: too many #ifdefs
Problem: Too many #ifdefs. Solution: Graduate FEAT_MBYTE, part 3.
This commit is contained in:
@@ -165,18 +165,12 @@ mch_inchar(
|
|||||||
|
|
||||||
for (;;) /* repeat until we got a character */
|
for (;;) /* repeat until we got a character */
|
||||||
{
|
{
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
len = Read(raw_in, (char *)buf, (long)maxlen / input_conv.vc_factor);
|
len = Read(raw_in, (char *)buf, (long)maxlen / input_conv.vc_factor);
|
||||||
# else
|
|
||||||
len = Read(raw_in, (char *)buf, (long)maxlen);
|
|
||||||
# endif
|
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* Convert from 'termencoding' to 'encoding'. */
|
/* Convert from 'termencoding' to 'encoding'. */
|
||||||
if (input_conv.vc_type != CONV_NONE)
|
if (input_conv.vc_type != CONV_NONE)
|
||||||
len = convert_input(buf, len, maxlen);
|
len = convert_input(buf, len, maxlen);
|
||||||
#endif
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -282,7 +282,6 @@ mch_settitle(
|
|||||||
# else
|
# else
|
||||||
if (title != NULL)
|
if (title != NULL)
|
||||||
{
|
{
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
/* Convert the title from 'encoding' to the active codepage. */
|
/* Convert the title from 'encoding' to the active codepage. */
|
||||||
@@ -295,7 +294,6 @@ mch_settitle(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
SetConsoleTitle((LPCSTR)title);
|
SetConsoleTitle((LPCSTR)title);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
@@ -361,7 +359,6 @@ mch_FullName(
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
WCHAR *wname;
|
WCHAR *wname;
|
||||||
@@ -387,7 +384,6 @@ mch_FullName(
|
|||||||
vim_free(cname);
|
vim_free(cname);
|
||||||
}
|
}
|
||||||
if (nResult == FAIL) /* fall back to non-wide function */
|
if (nResult == FAIL) /* fall back to non-wide function */
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (_fullpath((char *)buf, (const char *)fname, len - 1) == NULL)
|
if (_fullpath((char *)buf, (const char *)fname, len - 1) == NULL)
|
||||||
{
|
{
|
||||||
@@ -415,14 +411,10 @@ mch_FullName(
|
|||||||
int
|
int
|
||||||
mch_isFullName(char_u *fname)
|
mch_isFullName(char_u *fname)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* WinNT and later can use _MAX_PATH wide characters for a pathname, which
|
/* WinNT and later can use _MAX_PATH wide characters for a pathname, which
|
||||||
* means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
|
* means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
|
||||||
* UTF-8. */
|
* UTF-8. */
|
||||||
char szName[_MAX_PATH * 3 + 1];
|
char szName[_MAX_PATH * 3 + 1];
|
||||||
#else
|
|
||||||
char szName[_MAX_PATH + 1];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* A name like "d:/foo" and "//server/share" is absolute */
|
/* A name like "d:/foo" and "//server/share" is absolute */
|
||||||
if ((fname[0] && fname[1] == ':' && (fname[2] == '/' || fname[2] == '\\'))
|
if ((fname[0] && fname[1] == ':' && (fname[2] == '/' || fname[2] == '\\'))
|
||||||
@@ -538,11 +530,10 @@ stat_symlink_aware(const char *name, stat_T *stp)
|
|||||||
return stat(name, stp);
|
return stat(name, stp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
static int
|
static int
|
||||||
wstat_symlink_aware(const WCHAR *name, stat_T *stp)
|
wstat_symlink_aware(const WCHAR *name, stat_T *stp)
|
||||||
{
|
{
|
||||||
# if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__MINGW32__)
|
#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__MINGW32__)
|
||||||
/* Work around for VC12 or earlier (and MinGW). _wstat() can't handle
|
/* Work around for VC12 or earlier (and MinGW). _wstat() can't handle
|
||||||
* symlinks properly.
|
* symlinks properly.
|
||||||
* VC9 or earlier: _wstat() doesn't support a symlink at all. It retrieves
|
* VC9 or earlier: _wstat() doesn't support a symlink at all. It retrieves
|
||||||
@@ -587,10 +578,9 @@ wstat_symlink_aware(const WCHAR *name, stat_T *stp)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
return _wstat(name, (struct _stat *)stp);
|
return _wstat(name, (struct _stat *)stp);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* stat() can't handle a trailing '/' or '\', remove it first.
|
* stat() can't handle a trailing '/' or '\', remove it first.
|
||||||
@@ -598,14 +588,10 @@ wstat_symlink_aware(const WCHAR *name, stat_T *stp)
|
|||||||
int
|
int
|
||||||
vim_stat(const char *name, stat_T *stp)
|
vim_stat(const char *name, stat_T *stp)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* WinNT and later can use _MAX_PATH wide characters for a pathname, which
|
/* WinNT and later can use _MAX_PATH wide characters for a pathname, which
|
||||||
* means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
|
* means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
|
||||||
* UTF-8. */
|
* UTF-8. */
|
||||||
char_u buf[_MAX_PATH * 3 + 1];
|
char_u buf[_MAX_PATH * 3 + 1];
|
||||||
#else
|
|
||||||
char_u buf[_MAX_PATH + 1];
|
|
||||||
#endif
|
|
||||||
char_u *p;
|
char_u *p;
|
||||||
|
|
||||||
vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1);
|
vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1);
|
||||||
@@ -628,7 +614,6 @@ vim_stat(const char *name, stat_T *stp)
|
|||||||
STRCAT(buf, "\\");
|
STRCAT(buf, "\\");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
WCHAR *wp = enc_to_utf16(buf, NULL);
|
WCHAR *wp = enc_to_utf16(buf, NULL);
|
||||||
@@ -641,7 +626,6 @@ vim_stat(const char *name, stat_T *stp)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return stat_symlink_aware((char *)buf, stp);
|
return stat_symlink_aware((char *)buf, stp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -791,7 +775,6 @@ mch_chdir(char *path)
|
|||||||
if (*path == NUL) /* drive name only */
|
if (*path == NUL) /* drive name only */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
WCHAR *p = enc_to_utf16((char_u *)path, NULL);
|
WCHAR *p = enc_to_utf16((char_u *)path, NULL);
|
||||||
@@ -804,7 +787,6 @@ mch_chdir(char *path)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return chdir(path); /* let the normal chdir() do the rest */
|
return chdir(path); /* let the normal chdir() do the rest */
|
||||||
}
|
}
|
||||||
@@ -1145,9 +1127,6 @@ static char_u *prt_name = NULL;
|
|||||||
#define IDC_PRINTTEXT2 402
|
#define IDC_PRINTTEXT2 402
|
||||||
#define IDC_PROGRESS 403
|
#define IDC_PROGRESS 403
|
||||||
|
|
||||||
#if !defined(FEAT_MBYTE)
|
|
||||||
# define vimSetDlgItemText(h, i, s) SetDlgItemText(h, i, s)
|
|
||||||
#else
|
|
||||||
static BOOL
|
static BOOL
|
||||||
vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s)
|
vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s)
|
||||||
{
|
{
|
||||||
@@ -1166,7 +1145,6 @@ vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s)
|
|||||||
}
|
}
|
||||||
return SetDlgItemText(hDlg, nIDDlgItem, (LPCSTR)s);
|
return SetDlgItemText(hDlg, nIDDlgItem, (LPCSTR)s);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert BGR to RGB for Windows GDI calls
|
* Convert BGR to RGB for Windows GDI calls
|
||||||
@@ -1563,7 +1541,6 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
|
|||||||
char_u *printer_name = (char_u *)devname + devname->wDeviceOffset;
|
char_u *printer_name = (char_u *)devname + devname->wDeviceOffset;
|
||||||
char_u *port_name = (char_u *)devname +devname->wOutputOffset;
|
char_u *port_name = (char_u *)devname +devname->wOutputOffset;
|
||||||
char_u *text = (char_u *)_("to %s on %s");
|
char_u *text = (char_u *)_("to %s on %s");
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
char_u *printer_name_orig = printer_name;
|
char_u *printer_name_orig = printer_name;
|
||||||
char_u *port_name_orig = port_name;
|
char_u *port_name_orig = port_name;
|
||||||
|
|
||||||
@@ -1580,18 +1557,15 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
|
|||||||
if (to_free != NULL)
|
if (to_free != NULL)
|
||||||
port_name = to_free;
|
port_name = to_free;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
prt_name = alloc((unsigned)(STRLEN(printer_name) + STRLEN(port_name)
|
prt_name = alloc((unsigned)(STRLEN(printer_name) + STRLEN(port_name)
|
||||||
+ STRLEN(text)));
|
+ STRLEN(text)));
|
||||||
if (prt_name != NULL)
|
if (prt_name != NULL)
|
||||||
wsprintf((char *)prt_name, (const char *)text,
|
wsprintf((char *)prt_name, (const char *)text,
|
||||||
printer_name, port_name);
|
printer_name, port_name);
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (printer_name != printer_name_orig)
|
if (printer_name != printer_name_orig)
|
||||||
vim_free(printer_name);
|
vim_free(printer_name);
|
||||||
if (port_name != port_name_orig)
|
if (port_name != port_name_orig)
|
||||||
vim_free(port_name);
|
vim_free(port_name);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
GlobalUnlock(prt_dlg.hDevNames);
|
GlobalUnlock(prt_dlg.hDevNames);
|
||||||
|
|
||||||
@@ -1680,9 +1654,7 @@ mch_print_begin(prt_settings_T *psettings)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char szBuffer[300];
|
char szBuffer[300];
|
||||||
#if defined(FEAT_MBYTE)
|
|
||||||
WCHAR *wp = NULL;
|
WCHAR *wp = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
hDlgPrint = CreateDialog(GetModuleHandle(NULL), TEXT("PrintDlgBox"),
|
hDlgPrint = CreateDialog(GetModuleHandle(NULL), TEXT("PrintDlgBox"),
|
||||||
prt_dlg.hwndOwner, PrintDlgProc);
|
prt_dlg.hwndOwner, PrintDlgProc);
|
||||||
@@ -1690,7 +1662,6 @@ mch_print_begin(prt_settings_T *psettings)
|
|||||||
wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname));
|
wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname));
|
||||||
vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (char_u *)szBuffer);
|
vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (char_u *)szBuffer);
|
||||||
|
|
||||||
#if defined(FEAT_MBYTE)
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
wp = enc_to_utf16(psettings->jobname, NULL);
|
wp = enc_to_utf16(psettings->jobname, NULL);
|
||||||
if (wp != NULL)
|
if (wp != NULL)
|
||||||
@@ -1704,7 +1675,6 @@ mch_print_begin(prt_settings_T *psettings)
|
|||||||
vim_free(wp);
|
vim_free(wp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
DOCINFO di;
|
DOCINFO di;
|
||||||
|
|
||||||
@@ -1767,10 +1737,7 @@ mch_print_start_line(int margin, int page_line)
|
|||||||
int
|
int
|
||||||
mch_print_text_out(char_u *p, int len)
|
mch_print_text_out(char_u *p, int len)
|
||||||
{
|
{
|
||||||
#if defined(FEAT_PROPORTIONAL_FONTS) || defined(FEAT_MBYTE)
|
|
||||||
SIZE sz;
|
SIZE sz;
|
||||||
#endif
|
|
||||||
#if defined(FEAT_MBYTE)
|
|
||||||
WCHAR *wp = NULL;
|
WCHAR *wp = NULL;
|
||||||
int wlen = len;
|
int wlen = len;
|
||||||
|
|
||||||
@@ -1801,7 +1768,6 @@ mch_print_text_out(char_u *p, int len)
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
TextOut(prt_dlg.hDC, prt_pos_x + prt_left_margin,
|
TextOut(prt_dlg.hDC, prt_pos_x + prt_left_margin,
|
||||||
prt_pos_y + prt_top_margin,
|
prt_pos_y + prt_top_margin,
|
||||||
(LPCSTR)p, len);
|
(LPCSTR)p, len);
|
||||||
@@ -1873,10 +1839,8 @@ mch_resolve_shortcut(char_u *fname)
|
|||||||
CHAR buf[MAX_PATH]; // could have simply reused 'wsz'...
|
CHAR buf[MAX_PATH]; // could have simply reused 'wsz'...
|
||||||
char_u *rfname = NULL;
|
char_u *rfname = NULL;
|
||||||
int len;
|
int len;
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
IShellLinkW *pslw = NULL;
|
IShellLinkW *pslw = NULL;
|
||||||
WIN32_FIND_DATAW ffdw; // we get those free of charge
|
WIN32_FIND_DATAW ffdw; // we get those free of charge
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Check if the file name ends in ".lnk". Avoid calling
|
/* Check if the file name ends in ".lnk". Avoid calling
|
||||||
* CoCreateInstance(), it's quite slow. */
|
* CoCreateInstance(), it's quite slow. */
|
||||||
@@ -1888,7 +1852,6 @@ mch_resolve_shortcut(char_u *fname)
|
|||||||
|
|
||||||
CoInitialize(NULL);
|
CoInitialize(NULL);
|
||||||
|
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
// create a link manager object and request its interface
|
// create a link manager object and request its interface
|
||||||
@@ -1930,7 +1893,6 @@ shortcut_errorw:
|
|||||||
}
|
}
|
||||||
goto shortcut_end;
|
goto shortcut_end;
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
// create a link manager object and request its interface
|
// create a link manager object and request its interface
|
||||||
hr = CoCreateInstance(
|
hr = CoCreateInstance(
|
||||||
&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
||||||
@@ -1969,10 +1931,8 @@ shortcut_end:
|
|||||||
ppf->lpVtbl->Release(ppf);
|
ppf->lpVtbl->Release(ppf);
|
||||||
if (psl != NULL)
|
if (psl != NULL)
|
||||||
psl->lpVtbl->Release(psl);
|
psl->lpVtbl->Release(psl);
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
if (pslw != NULL)
|
if (pslw != NULL)
|
||||||
pslw->lpVtbl->Release(pslw);
|
pslw->lpVtbl->Release(pslw);
|
||||||
# endif
|
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
return rfname;
|
return rfname;
|
||||||
@@ -2042,13 +2002,8 @@ serverSendEnc(HWND target)
|
|||||||
COPYDATASTRUCT data;
|
COPYDATASTRUCT data;
|
||||||
|
|
||||||
data.dwData = COPYDATA_ENCODING;
|
data.dwData = COPYDATA_ENCODING;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
data.cbData = (DWORD)STRLEN(p_enc) + 1;
|
data.cbData = (DWORD)STRLEN(p_enc) + 1;
|
||||||
data.lpData = p_enc;
|
data.lpData = p_enc;
|
||||||
#else
|
|
||||||
data.cbData = (DWORD)STRLEN("latin1") + 1;
|
|
||||||
data.lpData = "latin1";
|
|
||||||
#endif
|
|
||||||
(void)SendMessage(target, WM_COPYDATA, (WPARAM)message_window,
|
(void)SendMessage(target, WM_COPYDATA, (WPARAM)message_window,
|
||||||
(LPARAM)(&data));
|
(LPARAM)(&data));
|
||||||
}
|
}
|
||||||
@@ -2118,11 +2073,9 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
switch (data->dwData)
|
switch (data->dwData)
|
||||||
{
|
{
|
||||||
case COPYDATA_ENCODING:
|
case COPYDATA_ENCODING:
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
/* Remember the encoding that the client uses. */
|
/* Remember the encoding that the client uses. */
|
||||||
vim_free(client_enc);
|
vim_free(client_enc);
|
||||||
client_enc = enc_canonize((char_u *)data->lpData);
|
client_enc = enc_canonize((char_u *)data->lpData);
|
||||||
# endif
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case COPYDATA_KEYS:
|
case COPYDATA_KEYS:
|
||||||
@@ -2954,15 +2907,12 @@ get_logfont(
|
|||||||
int i;
|
int i;
|
||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
static LOGFONT *lastlf = NULL;
|
static LOGFONT *lastlf = NULL;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
char_u *acpname = NULL;
|
char_u *acpname = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
*lf = s_lfDefault;
|
*lf = s_lfDefault;
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* Convert 'name' from 'encoding' to the current codepage, because
|
/* Convert 'name' from 'encoding' to the current codepage, because
|
||||||
* lf->lfFaceName uses the current codepage.
|
* lf->lfFaceName uses the current codepage.
|
||||||
* TODO: Use Wide APIs instead of ANSI APIs. */
|
* TODO: Use Wide APIs instead of ANSI APIs. */
|
||||||
@@ -2972,7 +2922,6 @@ get_logfont(
|
|||||||
enc_to_acp(name, (int)STRLEN(name), &acpname, &len);
|
enc_to_acp(name, (int)STRLEN(name), &acpname, &len);
|
||||||
name = acpname;
|
name = acpname;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (STRCMP(name, "*") == 0)
|
if (STRCMP(name, "*") == 0)
|
||||||
{
|
{
|
||||||
#if defined(FEAT_GUI_W32)
|
#if defined(FEAT_GUI_W32)
|
||||||
@@ -3112,9 +3061,7 @@ theend:
|
|||||||
if (lastlf != NULL)
|
if (lastlf != NULL)
|
||||||
mch_memmove(lastlf, lf, sizeof(LOGFONT));
|
mch_memmove(lastlf, lf, sizeof(LOGFONT));
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
vim_free(acpname);
|
vim_free(acpname);
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2054,19 +2054,12 @@ get_x11_thing(
|
|||||||
retval = TRUE;
|
retval = TRUE;
|
||||||
if (!test_only)
|
if (!test_only)
|
||||||
{
|
{
|
||||||
#if defined(FEAT_XFONTSET) || defined(FEAT_MBYTE)
|
if (text_prop.encoding == XA_STRING && !has_mbyte)
|
||||||
if (text_prop.encoding == XA_STRING
|
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
&& !has_mbyte
|
|
||||||
# endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
#endif
|
|
||||||
if (get_title)
|
if (get_title)
|
||||||
oldtitle = vim_strsave((char_u *)text_prop.value);
|
oldtitle = vim_strsave((char_u *)text_prop.value);
|
||||||
else
|
else
|
||||||
oldicon = vim_strsave((char_u *)text_prop.value);
|
oldicon = vim_strsave((char_u *)text_prop.value);
|
||||||
#if defined(FEAT_XFONTSET) || defined(FEAT_MBYTE)
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2093,7 +2086,6 @@ get_x11_thing(
|
|||||||
oldicon = vim_strsave((char_u *)text_prop.value);
|
oldicon = vim_strsave((char_u *)text_prop.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
XFree((void *)text_prop.value);
|
XFree((void *)text_prop.value);
|
||||||
}
|
}
|
||||||
@@ -2105,7 +2097,7 @@ get_x11_thing(
|
|||||||
* systems X_HAVE_UTF8_STRING may be defined in a header file but
|
* systems X_HAVE_UTF8_STRING may be defined in a header file but
|
||||||
* Xutf8SetWMProperties() is not in the X11 library. Configure checks for
|
* Xutf8SetWMProperties() is not in the X11 library. Configure checks for
|
||||||
* that and defines HAVE_XUTF8SETWMPROPERTIES. */
|
* that and defines HAVE_XUTF8SETWMPROPERTIES. */
|
||||||
#if defined(X_HAVE_UTF8_STRING) && defined(FEAT_MBYTE)
|
#if defined(X_HAVE_UTF8_STRING)
|
||||||
# if X_HAVE_UTF8_STRING && HAVE_XUTF8SETWMPROPERTIES
|
# if X_HAVE_UTF8_STRING && HAVE_XUTF8SETWMPROPERTIES
|
||||||
# define USE_UTF8_STRING
|
# define USE_UTF8_STRING
|
||||||
# endif
|
# endif
|
||||||
@@ -4823,9 +4815,7 @@ mch_call_shell_fork(
|
|||||||
{
|
{
|
||||||
# define BUFLEN 100 /* length for buffer, pseudo tty limit is 128 */
|
# define BUFLEN 100 /* length for buffer, pseudo tty limit is 128 */
|
||||||
char_u buffer[BUFLEN + 1];
|
char_u buffer[BUFLEN + 1];
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
int buffer_off = 0; /* valid bytes in buffer[] */
|
int buffer_off = 0; /* valid bytes in buffer[] */
|
||||||
# endif
|
|
||||||
char_u ta_buf[BUFLEN + 1]; /* TypeAHead */
|
char_u ta_buf[BUFLEN + 1]; /* TypeAHead */
|
||||||
int ta_len = 0; /* valid bytes in ta_buf[] */
|
int ta_len = 0; /* valid bytes in ta_buf[] */
|
||||||
int len;
|
int len;
|
||||||
@@ -5031,11 +5021,9 @@ mch_call_shell_fork(
|
|||||||
}
|
}
|
||||||
else if (ta_buf[i] == '\r')
|
else if (ta_buf[i] == '\r')
|
||||||
ta_buf[i] = '\n';
|
ta_buf[i] = '\n';
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
i += (*mb_ptr2len_len)(ta_buf + i,
|
i += (*mb_ptr2len_len)(ta_buf + i,
|
||||||
ta_len + len - i) - 1;
|
ta_len + len - i) - 1;
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -5048,7 +5036,6 @@ mch_call_shell_fork(
|
|||||||
{
|
{
|
||||||
if (ta_buf[i] == '\n' || ta_buf[i] == '\b')
|
if (ta_buf[i] == '\n' || ta_buf[i] == '\b')
|
||||||
msg_putchar(ta_buf[i]);
|
msg_putchar(ta_buf[i]);
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
else if (has_mbyte)
|
else if (has_mbyte)
|
||||||
{
|
{
|
||||||
int l = (*mb_ptr2len)(ta_buf + i);
|
int l = (*mb_ptr2len)(ta_buf + i);
|
||||||
@@ -5056,7 +5043,6 @@ mch_call_shell_fork(
|
|||||||
msg_outtrans_len(ta_buf + i, l);
|
msg_outtrans_len(ta_buf + i, l);
|
||||||
i += l - 1;
|
i += l - 1;
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
else
|
else
|
||||||
msg_outtrans_len(ta_buf + i, 1);
|
msg_outtrans_len(ta_buf + i, 1);
|
||||||
}
|
}
|
||||||
@@ -5114,11 +5100,7 @@ mch_call_shell_fork(
|
|||||||
while (RealWaitForChar(fromshell_fd, 10L, NULL, NULL))
|
while (RealWaitForChar(fromshell_fd, 10L, NULL, NULL))
|
||||||
{
|
{
|
||||||
len = read_eintr(fromshell_fd, buffer
|
len = read_eintr(fromshell_fd, buffer
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
+ buffer_off, (size_t)(BUFLEN - buffer_off)
|
+ buffer_off, (size_t)(BUFLEN - buffer_off)
|
||||||
# else
|
|
||||||
, (size_t)BUFLEN
|
|
||||||
# endif
|
|
||||||
);
|
);
|
||||||
if (len <= 0) /* end of file or error */
|
if (len <= 0) /* end of file or error */
|
||||||
goto finished;
|
goto finished;
|
||||||
@@ -5138,7 +5120,6 @@ mch_call_shell_fork(
|
|||||||
ga_append(&ga, buffer[i]);
|
ga_append(&ga, buffer[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
else if (has_mbyte)
|
else if (has_mbyte)
|
||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
@@ -5181,7 +5162,6 @@ mch_call_shell_fork(
|
|||||||
}
|
}
|
||||||
buffer_off = 0;
|
buffer_off = 0;
|
||||||
}
|
}
|
||||||
# endif /* FEAT_MBYTE */
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer[len] = NUL;
|
buffer[len] = NUL;
|
||||||
|
|||||||
@@ -130,9 +130,7 @@ errout:
|
|||||||
free(argv);
|
free(argv);
|
||||||
if (tofree != NULL)
|
if (tofree != NULL)
|
||||||
free(tofree);
|
free(tofree);
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
free_cmd_argsW();
|
free_cmd_argsW();
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
134
src/os_win32.c
134
src/os_win32.c
@@ -452,11 +452,7 @@ unescape_shellxquote(char_u *p, char_u *escaped)
|
|||||||
{
|
{
|
||||||
if (*p == '^' && vim_strchr(escaped, p[1]) != NULL)
|
if (*p == '^' && vim_strchr(escaped, p[1]) != NULL)
|
||||||
mch_memmove(p, p + 1, l--);
|
mch_memmove(p, p + 1, l--);
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
n = (*mb_ptr2len)(p);
|
n = (*mb_ptr2len)(p);
|
||||||
#else
|
|
||||||
n = 1;
|
|
||||||
#endif
|
|
||||||
p += n;
|
p += n;
|
||||||
l -= n;
|
l -= n;
|
||||||
}
|
}
|
||||||
@@ -1890,7 +1886,6 @@ mch_inchar(
|
|||||||
{
|
{
|
||||||
int n = 1;
|
int n = 1;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (ch2 == NUL)
|
if (ch2 == NUL)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -1912,7 +1907,6 @@ mch_inchar(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
typeahead[typeaheadlen] = c;
|
typeahead[typeaheadlen] = c;
|
||||||
if (ch2 != NUL)
|
if (ch2 != NUL)
|
||||||
{
|
{
|
||||||
@@ -1950,17 +1944,11 @@ mch_inchar(
|
|||||||
if ((modifiers & MOD_MASK_ALT)
|
if ((modifiers & MOD_MASK_ALT)
|
||||||
&& n == 1
|
&& n == 1
|
||||||
&& (typeahead[typeaheadlen] & 0x80) == 0
|
&& (typeahead[typeaheadlen] & 0x80) == 0
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
&& !enc_dbcs
|
&& !enc_dbcs
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
n = (*mb_char2bytes)(typeahead[typeaheadlen] | 0x80,
|
n = (*mb_char2bytes)(typeahead[typeaheadlen] | 0x80,
|
||||||
typeahead + typeaheadlen);
|
typeahead + typeaheadlen);
|
||||||
#else
|
|
||||||
typeahead[typeaheadlen] |= 0x80;
|
|
||||||
#endif
|
|
||||||
modifiers &= ~MOD_MASK_ALT;
|
modifiers &= ~MOD_MASK_ALT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2044,7 +2032,6 @@ executable_exists(char *name, char_u **path, int use_path)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
WCHAR *p = enc_to_utf16((char_u *)name, NULL);
|
WCHAR *p = enc_to_utf16((char_u *)name, NULL);
|
||||||
@@ -2073,7 +2060,6 @@ executable_exists(char *name, char_u **path, int use_path)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
curpath = getenv("PATH");
|
curpath = getenv("PATH");
|
||||||
newpath = (char*)alloc((unsigned)(STRLEN(curpath) + 3));
|
newpath = (char*)alloc((unsigned)(STRLEN(curpath) + 3));
|
||||||
@@ -2768,7 +2754,6 @@ mch_check_win(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/*
|
/*
|
||||||
* fname_casew(): Wide version of fname_case(). Set the case of the file name,
|
* fname_casew(): Wide version of fname_case(). Set the case of the file name,
|
||||||
* if it already exists. When "len" is > 0, also expand short to long
|
* if it already exists. When "len" is > 0, also expand short to long
|
||||||
@@ -2878,7 +2863,6 @@ fname_casew(
|
|||||||
wcscpy(name, szTrueName);
|
wcscpy(name, szTrueName);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fname_case(): Set the case of the file name, if it already exists.
|
* fname_case(): Set the case of the file name, if it already exists.
|
||||||
@@ -2906,7 +2890,6 @@ fname_case(
|
|||||||
|
|
||||||
slash_adjust(name);
|
slash_adjust(name);
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
WCHAR *p = enc_to_utf16(name, NULL);
|
WCHAR *p = enc_to_utf16(name, NULL);
|
||||||
@@ -2933,7 +2916,6 @@ fname_case(
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If 'enc' is utf-8, flen can be larger than _MAX_PATH.
|
/* If 'enc' is utf-8, flen can be larger than _MAX_PATH.
|
||||||
* So we should check this after calling wide function. */
|
* So we should check this after calling wide function. */
|
||||||
@@ -2962,7 +2944,6 @@ fname_case(
|
|||||||
porigPrev = porig;
|
porigPrev = porig;
|
||||||
while (*porig != NUL && *porig != psepc)
|
while (*porig != NUL && *porig != psepc)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
if (enc_dbcs)
|
if (enc_dbcs)
|
||||||
@@ -2972,7 +2953,6 @@ fname_case(
|
|||||||
*ptrue++ = *porig++;
|
*ptrue++ = *porig++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
*ptrue++ = *porig++;
|
*ptrue++ = *porig++;
|
||||||
}
|
}
|
||||||
*ptrue = NUL;
|
*ptrue = NUL;
|
||||||
@@ -3044,7 +3024,6 @@ mch_get_user_name(
|
|||||||
char szUserName[256 + 1]; /* UNLEN is 256 */
|
char szUserName[256 + 1]; /* UNLEN is 256 */
|
||||||
DWORD cch = sizeof szUserName;
|
DWORD cch = sizeof szUserName;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
WCHAR wszUserName[256 + 1]; /* UNLEN is 256 */
|
WCHAR wszUserName[256 + 1]; /* UNLEN is 256 */
|
||||||
@@ -3062,7 +3041,6 @@ mch_get_user_name(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (GetUserName(szUserName, &cch))
|
if (GetUserName(szUserName, &cch))
|
||||||
{
|
{
|
||||||
vim_strncpy(s, (char_u *)szUserName, len - 1);
|
vim_strncpy(s, (char_u *)szUserName, len - 1);
|
||||||
@@ -3083,7 +3061,6 @@ mch_get_host_name(
|
|||||||
{
|
{
|
||||||
DWORD cch = len;
|
DWORD cch = len;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
WCHAR wszHostName[256 + 1];
|
WCHAR wszHostName[256 + 1];
|
||||||
@@ -3101,7 +3078,6 @@ mch_get_host_name(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (!GetComputerName((LPSTR)s, &cch))
|
if (!GetComputerName((LPSTR)s, &cch))
|
||||||
vim_strncpy(s, (char_u *)"PC (Win32 Vim)", len - 1);
|
vim_strncpy(s, (char_u *)"PC (Win32 Vim)", len - 1);
|
||||||
}
|
}
|
||||||
@@ -3135,7 +3111,6 @@ mch_dirname(
|
|||||||
* But the Win32s known bug list says that getcwd() doesn't work
|
* But the Win32s known bug list says that getcwd() doesn't work
|
||||||
* so use the Win32 system call instead. <Negri>
|
* so use the Win32 system call instead. <Negri>
|
||||||
*/
|
*/
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
WCHAR wbuf[_MAX_PATH + 1];
|
WCHAR wbuf[_MAX_PATH + 1];
|
||||||
@@ -3167,7 +3142,6 @@ mch_dirname(
|
|||||||
}
|
}
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (GetCurrentDirectory(len, (LPSTR)buf) == 0)
|
if (GetCurrentDirectory(len, (LPSTR)buf) == 0)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
lfnlen = GetLongPathNameA((LPCSTR)buf, (LPSTR)abuf, _MAX_PATH);
|
lfnlen = GetLongPathNameA((LPCSTR)buf, (LPSTR)abuf, _MAX_PATH);
|
||||||
@@ -3205,7 +3179,6 @@ mch_setperm(char_u *name, long perm)
|
|||||||
{
|
{
|
||||||
long n = -1;
|
long n = -1;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
WCHAR *p = enc_to_utf16(name, NULL);
|
WCHAR *p = enc_to_utf16(name, NULL);
|
||||||
@@ -3219,7 +3192,6 @@ mch_setperm(char_u *name, long perm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (n == -1)
|
if (n == -1)
|
||||||
#endif
|
|
||||||
n = _chmod((const char *)name, perm);
|
n = _chmod((const char *)name, perm);
|
||||||
if (n == -1)
|
if (n == -1)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@@ -3290,7 +3262,6 @@ mch_isrealdir(char_u *name)
|
|||||||
int
|
int
|
||||||
mch_mkdir(char_u *name)
|
mch_mkdir(char_u *name)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
WCHAR *p;
|
WCHAR *p;
|
||||||
@@ -3303,7 +3274,6 @@ mch_mkdir(char_u *name)
|
|||||||
vim_free(p);
|
vim_free(p);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return _mkdir((const char *)name);
|
return _mkdir((const char *)name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3314,7 +3284,6 @@ mch_mkdir(char_u *name)
|
|||||||
int
|
int
|
||||||
mch_rmdir(char_u *name)
|
mch_rmdir(char_u *name)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
WCHAR *p;
|
WCHAR *p;
|
||||||
@@ -3327,7 +3296,6 @@ mch_rmdir(char_u *name)
|
|||||||
vim_free(p);
|
vim_free(p);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return _rmdir((const char *)name);
|
return _rmdir((const char *)name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3353,7 +3321,6 @@ mch_is_symbolic_link(char_u *name)
|
|||||||
int res = FALSE;
|
int res = FALSE;
|
||||||
WIN32_FIND_DATAA findDataA;
|
WIN32_FIND_DATAA findDataA;
|
||||||
DWORD fileFlags = 0, reparseTag = 0;
|
DWORD fileFlags = 0, reparseTag = 0;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
WCHAR *wn = NULL;
|
WCHAR *wn = NULL;
|
||||||
WIN32_FIND_DATAW findDataW;
|
WIN32_FIND_DATAW findDataW;
|
||||||
|
|
||||||
@@ -3370,7 +3337,6 @@ mch_is_symbolic_link(char_u *name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
hFind = FindFirstFile((LPCSTR)name, &findDataA);
|
hFind = FindFirstFile((LPCSTR)name, &findDataA);
|
||||||
if (hFind != INVALID_HANDLE_VALUE)
|
if (hFind != INVALID_HANDLE_VALUE)
|
||||||
@@ -3415,7 +3381,6 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info)
|
|||||||
{
|
{
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
int res = FILEINFO_READ_FAIL;
|
int res = FILEINFO_READ_FAIL;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
WCHAR *wn = NULL;
|
WCHAR *wn = NULL;
|
||||||
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
@@ -3436,7 +3401,6 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info)
|
|||||||
vim_free(wn);
|
vim_free(wn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
hFile = CreateFile((LPCSTR)fname, /* file name */
|
hFile = CreateFile((LPCSTR)fname, /* file name */
|
||||||
GENERIC_READ, /* access mode */
|
GENERIC_READ, /* access mode */
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE, /* share mode */
|
FILE_SHARE_READ | FILE_SHARE_WRITE, /* share mode */
|
||||||
@@ -3466,7 +3430,6 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info)
|
|||||||
win32_getattrs(char_u *name)
|
win32_getattrs(char_u *name)
|
||||||
{
|
{
|
||||||
int attr;
|
int attr;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
WCHAR *p = NULL;
|
WCHAR *p = NULL;
|
||||||
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
@@ -3478,7 +3441,6 @@ win32_getattrs(char_u *name)
|
|||||||
vim_free(p);
|
vim_free(p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
attr = GetFileAttributes((char *)name);
|
attr = GetFileAttributes((char *)name);
|
||||||
|
|
||||||
return attr;
|
return attr;
|
||||||
@@ -3493,7 +3455,6 @@ win32_getattrs(char_u *name)
|
|||||||
win32_setattrs(char_u *name, int attrs)
|
win32_setattrs(char_u *name, int attrs)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
WCHAR *p = NULL;
|
WCHAR *p = NULL;
|
||||||
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
@@ -3505,7 +3466,6 @@ win32_setattrs(char_u *name, int attrs)
|
|||||||
vim_free(p);
|
vim_free(p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
res = SetFileAttributes((char *)name, attrs);
|
res = SetFileAttributes((char *)name, attrs);
|
||||||
|
|
||||||
return res ? 0 : -1;
|
return res ? 0 : -1;
|
||||||
@@ -3621,9 +3581,7 @@ mch_nodetype(char_u *name)
|
|||||||
{
|
{
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
int type;
|
int type;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
WCHAR *wn = NULL;
|
WCHAR *wn = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We can't open a file with a name "\\.\con" or "\\.\prn" and trying to
|
/* We can't open a file with a name "\\.\con" or "\\.\prn" and trying to
|
||||||
* read from it later will cause Vim to hang. Thus return NODE_WRITABLE
|
* read from it later will cause Vim to hang. Thus return NODE_WRITABLE
|
||||||
@@ -3631,7 +3589,6 @@ mch_nodetype(char_u *name)
|
|||||||
if (STRNCMP(name, "\\\\.\\", 4) == 0)
|
if (STRNCMP(name, "\\\\.\\", 4) == 0)
|
||||||
return NODE_WRITABLE;
|
return NODE_WRITABLE;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
wn = enc_to_utf16(name, NULL);
|
wn = enc_to_utf16(name, NULL);
|
||||||
|
|
||||||
@@ -3647,7 +3604,6 @@ mch_nodetype(char_u *name)
|
|||||||
vim_free(wn);
|
vim_free(wn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
hFile = CreateFile((LPCSTR)name, /* file name */
|
hFile = CreateFile((LPCSTR)name, /* file name */
|
||||||
GENERIC_WRITE, /* access mode */
|
GENERIC_WRITE, /* access mode */
|
||||||
0, /* share mode */
|
0, /* share mode */
|
||||||
@@ -3695,7 +3651,6 @@ mch_get_acl(char_u *fname)
|
|||||||
p = (struct my_acl *)alloc_clear((unsigned)sizeof(struct my_acl));
|
p = (struct my_acl *)alloc_clear((unsigned)sizeof(struct my_acl));
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
{
|
{
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
WCHAR *wn = NULL;
|
WCHAR *wn = NULL;
|
||||||
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
@@ -3737,7 +3692,6 @@ mch_get_acl(char_u *fname)
|
|||||||
vim_free(wn);
|
vim_free(wn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif
|
|
||||||
{
|
{
|
||||||
/* Try to retrieve the entire security descriptor. */
|
/* Try to retrieve the entire security descriptor. */
|
||||||
err = GetNamedSecurityInfo(
|
err = GetNamedSecurityInfo(
|
||||||
@@ -3815,9 +3769,7 @@ mch_set_acl(char_u *fname, vim_acl_T acl)
|
|||||||
|
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
{
|
{
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
WCHAR *wn = NULL;
|
WCHAR *wn = NULL;
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Set security flags */
|
/* Set security flags */
|
||||||
if (p->pSidOwner)
|
if (p->pSidOwner)
|
||||||
@@ -3836,7 +3788,6 @@ mch_set_acl(char_u *fname, vim_acl_T acl)
|
|||||||
if (p->pSacl)
|
if (p->pSacl)
|
||||||
sec_info |= SACL_SECURITY_INFORMATION;
|
sec_info |= SACL_SECURITY_INFORMATION;
|
||||||
|
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
wn = enc_to_utf16(fname, NULL);
|
wn = enc_to_utf16(fname, NULL);
|
||||||
if (wn != NULL)
|
if (wn != NULL)
|
||||||
@@ -3853,7 +3804,6 @@ mch_set_acl(char_u *fname, vim_acl_T acl)
|
|||||||
vim_free(wn);
|
vim_free(wn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif
|
|
||||||
{
|
{
|
||||||
(void)SetNamedSecurityInfo(
|
(void)SetNamedSecurityInfo(
|
||||||
(LPSTR)fname, // Abstract filename
|
(LPSTR)fname, // Abstract filename
|
||||||
@@ -4211,7 +4161,6 @@ vim_create_process(
|
|||||||
LPVOID *env,
|
LPVOID *env,
|
||||||
char *cwd)
|
char *cwd)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
@@ -4247,7 +4196,6 @@ vim_create_process(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
fallback:
|
fallback:
|
||||||
#endif
|
|
||||||
return CreateProcess(
|
return CreateProcess(
|
||||||
NULL, /* Executable name */
|
NULL, /* Executable name */
|
||||||
cmd, /* Command to execute */
|
cmd, /* Command to execute */
|
||||||
@@ -4267,7 +4215,6 @@ vim_shell_execute(
|
|||||||
char *cmd,
|
char *cmd,
|
||||||
INT n_show_cmd)
|
INT n_show_cmd)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
WCHAR *wcmd = enc_to_utf16((char_u *)cmd, NULL);
|
WCHAR *wcmd = enc_to_utf16((char_u *)cmd, NULL);
|
||||||
@@ -4279,7 +4226,6 @@ vim_shell_execute(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return ShellExecute(NULL, NULL, cmd, NULL, NULL, n_show_cmd);
|
return ShellExecute(NULL, NULL, cmd, NULL, NULL, n_show_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4466,20 +4412,9 @@ dump_pipe(int options,
|
|||||||
while (ret != 0 && availableBytes > 0)
|
while (ret != 0 && availableBytes > 0)
|
||||||
{
|
{
|
||||||
repeatCount++;
|
repeatCount++;
|
||||||
toRead =
|
toRead = (DWORD)(BUFLEN - *buffer_off);
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
(DWORD)(BUFLEN - *buffer_off);
|
|
||||||
# else
|
|
||||||
(DWORD)BUFLEN;
|
|
||||||
# endif
|
|
||||||
toRead = availableBytes < toRead ? availableBytes : toRead;
|
toRead = availableBytes < toRead ? availableBytes : toRead;
|
||||||
ReadFile(g_hChildStd_OUT_Rd, buffer
|
ReadFile(g_hChildStd_OUT_Rd, buffer + *buffer_off, toRead , &len, NULL);
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
+ *buffer_off, toRead
|
|
||||||
# else
|
|
||||||
, toRead
|
|
||||||
# endif
|
|
||||||
, &len, NULL);
|
|
||||||
|
|
||||||
/* If we haven't read anything, there is a problem */
|
/* If we haven't read anything, there is a problem */
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
@@ -4501,7 +4436,6 @@ dump_pipe(int options,
|
|||||||
ga_append(ga, buffer[i]);
|
ga_append(ga, buffer[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
else if (has_mbyte)
|
else if (has_mbyte)
|
||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
@@ -4545,7 +4479,6 @@ dump_pipe(int options,
|
|||||||
}
|
}
|
||||||
*buffer_off = 0;
|
*buffer_off = 0;
|
||||||
}
|
}
|
||||||
# endif /* FEAT_MBYTE */
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer[len] = NUL;
|
buffer[len] = NUL;
|
||||||
@@ -4740,11 +4673,9 @@ mch_system_piped(char *cmd, int options)
|
|||||||
}
|
}
|
||||||
else if (ta_buf[i] == '\r')
|
else if (ta_buf[i] == '\r')
|
||||||
ta_buf[i] = '\n';
|
ta_buf[i] = '\n';
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
i += (*mb_ptr2len_len)(ta_buf + i,
|
i += (*mb_ptr2len_len)(ta_buf + i,
|
||||||
ta_len + len - i) - 1;
|
ta_len + len - i) - 1;
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -4755,7 +4686,6 @@ mch_system_piped(char *cmd, int options)
|
|||||||
{
|
{
|
||||||
if (ta_buf[i] == '\n' || ta_buf[i] == '\b')
|
if (ta_buf[i] == '\n' || ta_buf[i] == '\b')
|
||||||
msg_putchar(ta_buf[i]);
|
msg_putchar(ta_buf[i]);
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
else if (has_mbyte)
|
else if (has_mbyte)
|
||||||
{
|
{
|
||||||
int l = (*mb_ptr2len)(ta_buf + i);
|
int l = (*mb_ptr2len)(ta_buf + i);
|
||||||
@@ -4763,7 +4693,6 @@ mch_system_piped(char *cmd, int options)
|
|||||||
msg_outtrans_len(ta_buf + i, l);
|
msg_outtrans_len(ta_buf + i, l);
|
||||||
i += l - 1;
|
i += l - 1;
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
else
|
else
|
||||||
msg_outtrans_len(ta_buf + i, 1);
|
msg_outtrans_len(ta_buf + i, 1);
|
||||||
}
|
}
|
||||||
@@ -4857,7 +4786,6 @@ mch_system(char *cmd, int options)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
static int
|
static int
|
||||||
mch_system(char *cmd, int options)
|
mch_system(char *cmd, int options)
|
||||||
{
|
{
|
||||||
@@ -4873,9 +4801,6 @@ mch_system(char *cmd, int options)
|
|||||||
}
|
}
|
||||||
return system(cmd);
|
return system(cmd);
|
||||||
}
|
}
|
||||||
# else
|
|
||||||
# define mch_system(c, o) system(c)
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -4972,7 +4897,6 @@ mch_call_shell(
|
|||||||
int tmode = cur_tmode;
|
int tmode = cur_tmode;
|
||||||
#ifdef FEAT_TITLE
|
#ifdef FEAT_TITLE
|
||||||
char szShellTitle[512];
|
char szShellTitle[512];
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
int did_set_title = FALSE;
|
int did_set_title = FALSE;
|
||||||
|
|
||||||
/* Change the title to reflect that we are in a subshell. */
|
/* Change the title to reflect that we are in a subshell. */
|
||||||
@@ -5003,7 +4927,6 @@ mch_call_shell(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!did_set_title)
|
if (!did_set_title)
|
||||||
# endif
|
|
||||||
/* Change the title to reflect that we are in a subshell. */
|
/* Change the title to reflect that we are in a subshell. */
|
||||||
if (GetConsoleTitle(szShellTitle, sizeof(szShellTitle) - 4) > 0)
|
if (GetConsoleTitle(szShellTitle, sizeof(szShellTitle) - 4) > 0)
|
||||||
{
|
{
|
||||||
@@ -5217,7 +5140,6 @@ mch_call_shell(
|
|||||||
"External commands will not pause after completion.\n"
|
"External commands will not pause after completion.\n"
|
||||||
"See :help win32-vimrun for more information.");
|
"See :help win32-vimrun for more information.");
|
||||||
char *title = _("Vim Warning");
|
char *title = _("Vim Warning");
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
WCHAR *wmsg = enc_to_utf16((char_u *)msg, NULL);
|
WCHAR *wmsg = enc_to_utf16((char_u *)msg, NULL);
|
||||||
@@ -5229,7 +5151,6 @@ mch_call_shell(
|
|||||||
vim_free(wtitle);
|
vim_free(wtitle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif
|
|
||||||
MessageBox(NULL, msg, title, MB_ICONWARNING);
|
MessageBox(NULL, msg, title, MB_ICONWARNING);
|
||||||
need_vimrun_warning = FALSE;
|
need_vimrun_warning = FALSE;
|
||||||
}
|
}
|
||||||
@@ -5294,8 +5215,8 @@ job_io_file_open(
|
|||||||
DWORD dwFlagsAndAttributes)
|
DWORD dwFlagsAndAttributes)
|
||||||
{
|
{
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
# ifdef FEAT_MBYTE
|
|
||||||
WCHAR *wn = NULL;
|
WCHAR *wn = NULL;
|
||||||
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
wn = enc_to_utf16(fname, NULL);
|
wn = enc_to_utf16(fname, NULL);
|
||||||
@@ -5308,7 +5229,6 @@ job_io_file_open(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wn == NULL)
|
if (wn == NULL)
|
||||||
# endif
|
|
||||||
h = CreateFile((LPCSTR)fname, dwDesiredAccess, dwShareMode,
|
h = CreateFile((LPCSTR)fname, dwDesiredAccess, dwShareMode,
|
||||||
lpSecurityAttributes, dwCreationDisposition,
|
lpSecurityAttributes, dwCreationDisposition,
|
||||||
dwFlagsAndAttributes, NULL);
|
dwFlagsAndAttributes, NULL);
|
||||||
@@ -6339,7 +6259,6 @@ write_chars(
|
|||||||
COORD coord = g_coord;
|
COORD coord = g_coord;
|
||||||
DWORD written;
|
DWORD written;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
static WCHAR *unicodebuf = NULL;
|
static WCHAR *unicodebuf = NULL;
|
||||||
@@ -6392,7 +6311,6 @@ write_chars(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (!USE_VTP)
|
if (!USE_VTP)
|
||||||
{
|
{
|
||||||
@@ -6763,10 +6681,8 @@ mch_delay(
|
|||||||
int
|
int
|
||||||
mch_remove(char_u *name)
|
mch_remove(char_u *name)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
WCHAR *wn = NULL;
|
WCHAR *wn = NULL;
|
||||||
int n;
|
int n;
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On Windows, deleting a directory's symbolic link is done by
|
* On Windows, deleting a directory's symbolic link is done by
|
||||||
@@ -6777,7 +6693,6 @@ mch_remove(char_u *name)
|
|||||||
|
|
||||||
win32_setattrs(name, FILE_ATTRIBUTE_NORMAL);
|
win32_setattrs(name, FILE_ATTRIBUTE_NORMAL);
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
wn = enc_to_utf16(name, NULL);
|
wn = enc_to_utf16(name, NULL);
|
||||||
@@ -6788,7 +6703,6 @@ mch_remove(char_u *name)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return DeleteFile((LPCSTR)name) ? 0 : -1;
|
return DeleteFile((LPCSTR)name) ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6839,7 +6753,6 @@ mch_total_mem(int special UNUSED)
|
|||||||
return (long_u)((ms.ullTotalPhys - WINNT_RESERVE_BYTES) / 1024);
|
return (long_u)((ms.ullTotalPhys - WINNT_RESERVE_BYTES) / 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/*
|
/*
|
||||||
* Same code as below, but with wide functions and no comments.
|
* Same code as below, but with wide functions and no comments.
|
||||||
* Return 0 for success, non-zero for failure.
|
* Return 0 for success, non-zero for failure.
|
||||||
@@ -6893,7 +6806,6 @@ mch_wrename(WCHAR *wold, WCHAR *wnew)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -6924,7 +6836,6 @@ mch_rename(
|
|||||||
char szNewPath[_MAX_PATH+1];
|
char szNewPath[_MAX_PATH+1];
|
||||||
char *pszFilePart;
|
char *pszFilePart;
|
||||||
HANDLE hf;
|
HANDLE hf;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
WCHAR *wold = NULL;
|
WCHAR *wold = NULL;
|
||||||
WCHAR *wnew = NULL;
|
WCHAR *wnew = NULL;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
@@ -6939,7 +6850,6 @@ mch_rename(
|
|||||||
vim_free(wnew);
|
vim_free(wnew);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* No need to play tricks unless the file name contains a "~" as the
|
* No need to play tricks unless the file name contains a "~" as the
|
||||||
@@ -7024,25 +6934,20 @@ mch_access(char *n, int p)
|
|||||||
{
|
{
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
int retval = -1; /* default: fail */
|
int retval = -1; /* default: fail */
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
WCHAR *wn = NULL;
|
WCHAR *wn = NULL;
|
||||||
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
wn = enc_to_utf16((char_u *)n, NULL);
|
wn = enc_to_utf16((char_u *)n, NULL);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mch_isdir((char_u *)n))
|
if (mch_isdir((char_u *)n))
|
||||||
{
|
{
|
||||||
char TempName[_MAX_PATH + 16] = "";
|
char TempName[_MAX_PATH + 16] = "";
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
WCHAR TempNameW[_MAX_PATH + 16] = L"";
|
WCHAR TempNameW[_MAX_PATH + 16] = L"";
|
||||||
#endif
|
|
||||||
|
|
||||||
if (p & R_OK)
|
if (p & R_OK)
|
||||||
{
|
{
|
||||||
/* Read check is performed by seeing if we can do a find file on
|
/* Read check is performed by seeing if we can do a find file on
|
||||||
* the directory for any file. */
|
* the directory for any file. */
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (wn != NULL)
|
if (wn != NULL)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -7062,7 +6967,6 @@ mch_access(char *n, int p)
|
|||||||
(void)FindClose(hFile);
|
(void)FindClose(hFile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char *pch;
|
char *pch;
|
||||||
WIN32_FIND_DATA d;
|
WIN32_FIND_DATA d;
|
||||||
@@ -7087,7 +6991,6 @@ mch_access(char *n, int p)
|
|||||||
* directories on read-only network shares. However, in
|
* directories on read-only network shares. However, in
|
||||||
* directories whose ACL allows writes but denies deletes will end
|
* directories whose ACL allows writes but denies deletes will end
|
||||||
* up keeping the temporary file :-(. */
|
* up keeping the temporary file :-(. */
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (wn != NULL)
|
if (wn != NULL)
|
||||||
{
|
{
|
||||||
if (!GetTempFileNameW(wn, L"VIM", 0, TempNameW))
|
if (!GetTempFileNameW(wn, L"VIM", 0, TempNameW))
|
||||||
@@ -7096,7 +6999,6 @@ mch_access(char *n, int p)
|
|||||||
DeleteFileW(TempNameW);
|
DeleteFileW(TempNameW);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (!GetTempFileName(n, "VIM", 0, TempName))
|
if (!GetTempFileName(n, "VIM", 0, TempName))
|
||||||
goto getout;
|
goto getout;
|
||||||
@@ -7114,12 +7016,10 @@ mch_access(char *n, int p)
|
|||||||
DWORD access_mode = ((p & W_OK) ? GENERIC_WRITE : 0)
|
DWORD access_mode = ((p & W_OK) ? GENERIC_WRITE : 0)
|
||||||
| ((p & R_OK) ? GENERIC_READ : 0);
|
| ((p & R_OK) ? GENERIC_READ : 0);
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (wn != NULL)
|
if (wn != NULL)
|
||||||
hFile = CreateFileW(wn, access_mode, share_mode,
|
hFile = CreateFileW(wn, access_mode, share_mode,
|
||||||
NULL, OPEN_EXISTING, 0, NULL);
|
NULL, OPEN_EXISTING, 0, NULL);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
hFile = CreateFile(n, access_mode, share_mode,
|
hFile = CreateFile(n, access_mode, share_mode,
|
||||||
NULL, OPEN_EXISTING, 0, NULL);
|
NULL, OPEN_EXISTING, 0, NULL);
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
@@ -7129,13 +7029,10 @@ mch_access(char *n, int p)
|
|||||||
|
|
||||||
retval = 0; /* success */
|
retval = 0; /* success */
|
||||||
getout:
|
getout:
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
vim_free(wn);
|
vim_free(wn);
|
||||||
#endif
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_MBYTE) || defined(PROTO)
|
|
||||||
/*
|
/*
|
||||||
* Version of open() that may use UTF-16 file name.
|
* Version of open() that may use UTF-16 file name.
|
||||||
*/
|
*/
|
||||||
@@ -7143,7 +7040,7 @@ getout:
|
|||||||
mch_open(const char *name, int flags, int mode)
|
mch_open(const char *name, int flags, int mode)
|
||||||
{
|
{
|
||||||
/* _wopen() does not work with Borland C 5.5: creates a read-only file. */
|
/* _wopen() does not work with Borland C 5.5: creates a read-only file. */
|
||||||
# ifndef __BORLANDC__
|
#ifndef __BORLANDC__
|
||||||
WCHAR *wn;
|
WCHAR *wn;
|
||||||
int f;
|
int f;
|
||||||
|
|
||||||
@@ -7157,7 +7054,7 @@ mch_open(const char *name, int flags, int mode)
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
/* open() can open a file which name is longer than _MAX_PATH bytes
|
/* open() can open a file which name is longer than _MAX_PATH bytes
|
||||||
* and shorter than _MAX_PATH characters successfully, but sometimes it
|
* and shorter than _MAX_PATH characters successfully, but sometimes it
|
||||||
@@ -7180,7 +7077,7 @@ mch_fopen(const char *name, const char *mode)
|
|||||||
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
# if defined(DEBUG) && _MSC_VER >= 1400
|
#if defined(DEBUG) && _MSC_VER >= 1400
|
||||||
/* Work around an annoying assertion in the Microsoft debug CRT
|
/* Work around an annoying assertion in the Microsoft debug CRT
|
||||||
* when mode's text/binary setting doesn't match _get_fmode(). */
|
* when mode's text/binary setting doesn't match _get_fmode(). */
|
||||||
char newMode = mode[strlen(mode) - 1];
|
char newMode = mode[strlen(mode) - 1];
|
||||||
@@ -7191,7 +7088,7 @@ mch_fopen(const char *name, const char *mode)
|
|||||||
_set_fmode(_O_TEXT);
|
_set_fmode(_O_TEXT);
|
||||||
else if (newMode == 'b')
|
else if (newMode == 'b')
|
||||||
_set_fmode(_O_BINARY);
|
_set_fmode(_O_BINARY);
|
||||||
# endif
|
#endif
|
||||||
wn = enc_to_utf16((char_u *)name, NULL);
|
wn = enc_to_utf16((char_u *)name, NULL);
|
||||||
wm = enc_to_utf16((char_u *)mode, NULL);
|
wm = enc_to_utf16((char_u *)mode, NULL);
|
||||||
if (wn != NULL && wm != NULL)
|
if (wn != NULL && wm != NULL)
|
||||||
@@ -7199,9 +7096,9 @@ mch_fopen(const char *name, const char *mode)
|
|||||||
vim_free(wn);
|
vim_free(wn);
|
||||||
vim_free(wm);
|
vim_free(wm);
|
||||||
|
|
||||||
# if defined(DEBUG) && _MSC_VER >= 1400
|
#if defined(DEBUG) && _MSC_VER >= 1400
|
||||||
_set_fmode(oldMode);
|
_set_fmode(oldMode);
|
||||||
# endif
|
#endif
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7214,9 +7111,7 @@ mch_fopen(const char *name, const char *mode)
|
|||||||
|
|
||||||
return fopen(name, mode);
|
return fopen(name, mode);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/*
|
/*
|
||||||
* SUB STREAM (aka info stream) handling:
|
* SUB STREAM (aka info stream) handling:
|
||||||
*
|
*
|
||||||
@@ -7360,7 +7255,6 @@ copy_infostreams(char_u *from, char_u *to)
|
|||||||
vim_free(fromw);
|
vim_free(fromw);
|
||||||
vim_free(tow);
|
vim_free(tow);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy file attributes from file "from" to file "to".
|
* Copy file attributes from file "from" to file "to".
|
||||||
@@ -7370,11 +7264,9 @@ copy_infostreams(char_u *from, char_u *to)
|
|||||||
int
|
int
|
||||||
mch_copy_file_attribute(char_u *from, char_u *to)
|
mch_copy_file_attribute(char_u *from, char_u *to)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* File streams only work on Windows NT and later. */
|
/* File streams only work on Windows NT and later. */
|
||||||
PlatformId();
|
PlatformId();
|
||||||
copy_infostreams(from, to);
|
copy_infostreams(from, to);
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7464,7 +7356,6 @@ myresetstkoflw(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(FEAT_MBYTE) || defined(PROTO)
|
|
||||||
/*
|
/*
|
||||||
* The command line arguments in UCS2
|
* The command line arguments in UCS2
|
||||||
*/
|
*/
|
||||||
@@ -7691,7 +7582,6 @@ fix_arg_enc(void)
|
|||||||
|
|
||||||
set_alist_count();
|
set_alist_count();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
mch_setenv(char *var, char *value, int x)
|
mch_setenv(char *var, char *value, int x)
|
||||||
@@ -7704,7 +7594,6 @@ mch_setenv(char *var, char *value, int x)
|
|||||||
|
|
||||||
sprintf((char *)envbuf, "%s=%s", var, value);
|
sprintf((char *)envbuf, "%s=%s", var, value);
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
{
|
{
|
||||||
WCHAR *p = enc_to_utf16(envbuf, NULL);
|
WCHAR *p = enc_to_utf16(envbuf, NULL);
|
||||||
@@ -7713,14 +7602,13 @@ mch_setenv(char *var, char *value, int x)
|
|||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
_wputenv(p);
|
_wputenv(p);
|
||||||
# ifdef libintl_wputenv
|
#ifdef libintl_wputenv
|
||||||
libintl_wputenv(p);
|
libintl_wputenv(p);
|
||||||
# endif
|
#endif
|
||||||
/* Unlike Un*x systems, we can free the string for _wputenv(). */
|
/* Unlike Un*x systems, we can free the string for _wputenv(). */
|
||||||
vim_free(p);
|
vim_free(p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
_putenv((char *)envbuf);
|
_putenv((char *)envbuf);
|
||||||
#ifdef libintl_putenv
|
#ifdef libintl_putenv
|
||||||
|
|||||||
@@ -804,7 +804,6 @@ qf_get_next_file_line(qfstate_T *state)
|
|||||||
else
|
else
|
||||||
state->linebuf = IObuff;
|
state->linebuf = IObuff;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
// Convert a line if it contains a non-ASCII character.
|
// Convert a line if it contains a non-ASCII character.
|
||||||
if (state->vc.vc_type != CONV_NONE && has_non_ascii(state->linebuf))
|
if (state->vc.vc_type != CONV_NONE && has_non_ascii(state->linebuf))
|
||||||
{
|
{
|
||||||
@@ -827,7 +826,6 @@ qf_get_next_file_line(qfstate_T *state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return QF_OK;
|
return QF_OK;
|
||||||
}
|
}
|
||||||
@@ -872,9 +870,7 @@ qf_get_nextline(qfstate_T *state)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
remove_bom(state->linebuf);
|
remove_bom(state->linebuf);
|
||||||
#endif
|
|
||||||
|
|
||||||
return QF_OK;
|
return QF_OK;
|
||||||
}
|
}
|
||||||
@@ -1538,11 +1534,9 @@ qf_setup_state(
|
|||||||
linenr_T lnumfirst,
|
linenr_T lnumfirst,
|
||||||
linenr_T lnumlast)
|
linenr_T lnumlast)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
pstate->vc.vc_type = CONV_NONE;
|
pstate->vc.vc_type = CONV_NONE;
|
||||||
if (enc != NULL && *enc != NUL)
|
if (enc != NULL && *enc != NUL)
|
||||||
convert_setup(&pstate->vc, enc, p_enc);
|
convert_setup(&pstate->vc, enc, p_enc);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (efile != NULL && (pstate->fd = mch_fopen((char *)efile, "r")) == NULL)
|
if (efile != NULL && (pstate->fd = mch_fopen((char *)efile, "r")) == NULL)
|
||||||
{
|
{
|
||||||
@@ -1576,10 +1570,8 @@ qf_cleanup_state(qfstate_T *pstate)
|
|||||||
fclose(pstate->fd);
|
fclose(pstate->fd);
|
||||||
|
|
||||||
vim_free(pstate->growbuf);
|
vim_free(pstate->growbuf);
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (pstate->vc.vc_type != CONV_NONE)
|
if (pstate->vc.vc_type != CONV_NONE)
|
||||||
convert_setup(&pstate->vc, NULL, NULL);
|
convert_setup(&pstate->vc, NULL, NULL);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -4690,9 +4682,7 @@ ex_make(exarg_T *eap)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
|
enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (is_loclist_cmd(eap->cmdidx))
|
if (is_loclist_cmd(eap->cmdidx))
|
||||||
wp = curwin;
|
wp = curwin;
|
||||||
@@ -5032,9 +5022,7 @@ ex_cfile(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
if (au_name != NULL)
|
if (au_name != NULL)
|
||||||
apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, NULL, FALSE, curbuf);
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
|
enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
|
||||||
#endif
|
|
||||||
#ifdef FEAT_BROWSE
|
#ifdef FEAT_BROWSE
|
||||||
if (cmdmod.browse)
|
if (cmdmod.browse)
|
||||||
{
|
{
|
||||||
@@ -7035,9 +7023,7 @@ hgr_get_ll(int *new_ll)
|
|||||||
hgr_search_file(
|
hgr_search_file(
|
||||||
qf_info_T *qi,
|
qf_info_T *qi,
|
||||||
char_u *fname,
|
char_u *fname,
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
vimconv_T *p_vc,
|
vimconv_T *p_vc,
|
||||||
#endif
|
|
||||||
regmatch_T *p_regmatch)
|
regmatch_T *p_regmatch)
|
||||||
{
|
{
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
@@ -7051,7 +7037,7 @@ hgr_search_file(
|
|||||||
while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int)
|
while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int)
|
||||||
{
|
{
|
||||||
char_u *line = IObuff;
|
char_u *line = IObuff;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
// Convert a line if 'encoding' is not utf-8 and
|
// Convert a line if 'encoding' is not utf-8 and
|
||||||
// the line contains a non-ASCII character.
|
// the line contains a non-ASCII character.
|
||||||
if (p_vc->vc_type != CONV_NONE
|
if (p_vc->vc_type != CONV_NONE
|
||||||
@@ -7061,7 +7047,6 @@ hgr_search_file(
|
|||||||
if (line == NULL)
|
if (line == NULL)
|
||||||
line = IObuff;
|
line = IObuff;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (vim_regexec(p_regmatch, line, (colnr_T)0))
|
if (vim_regexec(p_regmatch, line, (colnr_T)0))
|
||||||
{
|
{
|
||||||
@@ -7089,17 +7074,13 @@ hgr_search_file(
|
|||||||
) == FAIL)
|
) == FAIL)
|
||||||
{
|
{
|
||||||
got_int = TRUE;
|
got_int = TRUE;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (line != IObuff)
|
if (line != IObuff)
|
||||||
vim_free(line);
|
vim_free(line);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (line != IObuff)
|
if (line != IObuff)
|
||||||
vim_free(line);
|
vim_free(line);
|
||||||
#endif
|
|
||||||
++lnum;
|
++lnum;
|
||||||
line_breakcheck();
|
line_breakcheck();
|
||||||
}
|
}
|
||||||
@@ -7114,10 +7095,8 @@ hgr_search_file(
|
|||||||
hgr_search_files_in_dir(
|
hgr_search_files_in_dir(
|
||||||
qf_info_T *qi,
|
qf_info_T *qi,
|
||||||
char_u *dirname,
|
char_u *dirname,
|
||||||
regmatch_T *p_regmatch
|
regmatch_T *p_regmatch,
|
||||||
#ifdef FEAT_MBYTE
|
vimconv_T *p_vc
|
||||||
, vimconv_T *p_vc
|
|
||||||
#endif
|
|
||||||
#ifdef FEAT_MULTI_LANG
|
#ifdef FEAT_MULTI_LANG
|
||||||
, char_u *lang
|
, char_u *lang
|
||||||
#endif
|
#endif
|
||||||
@@ -7147,11 +7126,7 @@ hgr_search_files_in_dir(
|
|||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
hgr_search_file(qi, fnames[fi],
|
hgr_search_file(qi, fnames[fi], p_vc, p_regmatch);
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
p_vc,
|
|
||||||
#endif
|
|
||||||
p_regmatch);
|
|
||||||
}
|
}
|
||||||
FreeWild(fcount, fnames);
|
FreeWild(fcount, fnames);
|
||||||
}
|
}
|
||||||
@@ -7168,7 +7143,6 @@ hgr_search_in_rtp(qf_info_T *qi, regmatch_T *p_regmatch, char_u *lang)
|
|||||||
{
|
{
|
||||||
char_u *p;
|
char_u *p;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
vimconv_T vc;
|
vimconv_T vc;
|
||||||
|
|
||||||
// Help files are in utf-8 or latin1, convert lines when 'encoding'
|
// Help files are in utf-8 or latin1, convert lines when 'encoding'
|
||||||
@@ -7176,7 +7150,6 @@ hgr_search_in_rtp(qf_info_T *qi, regmatch_T *p_regmatch, char_u *lang)
|
|||||||
vc.vc_type = CONV_NONE;
|
vc.vc_type = CONV_NONE;
|
||||||
if (!enc_utf8)
|
if (!enc_utf8)
|
||||||
convert_setup(&vc, (char_u *)"utf-8", p_enc);
|
convert_setup(&vc, (char_u *)"utf-8", p_enc);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Go through all the directories in 'runtimepath'
|
// Go through all the directories in 'runtimepath'
|
||||||
p = p_rtp;
|
p = p_rtp;
|
||||||
@@ -7184,20 +7157,15 @@ hgr_search_in_rtp(qf_info_T *qi, regmatch_T *p_regmatch, char_u *lang)
|
|||||||
{
|
{
|
||||||
copy_option_part(&p, NameBuff, MAXPATHL, ",");
|
copy_option_part(&p, NameBuff, MAXPATHL, ",");
|
||||||
|
|
||||||
hgr_search_files_in_dir(qi, NameBuff, p_regmatch
|
hgr_search_files_in_dir(qi, NameBuff, p_regmatch, &vc
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
, &vc
|
|
||||||
#endif
|
|
||||||
#ifdef FEAT_MULTI_LANG
|
#ifdef FEAT_MULTI_LANG
|
||||||
, lang
|
, lang
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (vc.vc_type != CONV_NONE)
|
if (vc.vc_type != CONV_NONE)
|
||||||
convert_setup(&vc, NULL, NULL);
|
convert_setup(&vc, NULL, NULL);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
205
src/regexp.c
205
src/regexp.c
@@ -359,9 +359,7 @@ static int re_mult_next(char *what);
|
|||||||
|
|
||||||
static char_u e_missingbracket[] = N_("E769: Missing ] after %s[");
|
static char_u e_missingbracket[] = N_("E769: Missing ] after %s[");
|
||||||
static char_u e_reverse_range[] = N_("E944: Reverse range in character class");
|
static char_u e_reverse_range[] = N_("E944: Reverse range in character class");
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
static char_u e_large_class[] = N_("E945: Range too large in character class");
|
static char_u e_large_class[] = N_("E945: Range too large in character class");
|
||||||
#endif
|
|
||||||
static char_u e_unmatchedpp[] = N_("E53: Unmatched %s%%(");
|
static char_u e_unmatchedpp[] = N_("E53: Unmatched %s%%(");
|
||||||
static char_u e_unmatchedp[] = N_("E54: Unmatched %s(");
|
static char_u e_unmatchedp[] = N_("E54: Unmatched %s(");
|
||||||
static char_u e_unmatchedpar[] = N_("E55: Unmatched %s)");
|
static char_u e_unmatchedpar[] = N_("E55: Unmatched %s)");
|
||||||
@@ -561,27 +559,15 @@ init_class_tab(void)
|
|||||||
done = TRUE;
|
done = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
#define ri_digit(c) (c < 0x100 && (class_tab[c] & RI_DIGIT))
|
||||||
# define ri_digit(c) (c < 0x100 && (class_tab[c] & RI_DIGIT))
|
#define ri_hex(c) (c < 0x100 && (class_tab[c] & RI_HEX))
|
||||||
# define ri_hex(c) (c < 0x100 && (class_tab[c] & RI_HEX))
|
#define ri_octal(c) (c < 0x100 && (class_tab[c] & RI_OCTAL))
|
||||||
# define ri_octal(c) (c < 0x100 && (class_tab[c] & RI_OCTAL))
|
#define ri_word(c) (c < 0x100 && (class_tab[c] & RI_WORD))
|
||||||
# define ri_word(c) (c < 0x100 && (class_tab[c] & RI_WORD))
|
#define ri_head(c) (c < 0x100 && (class_tab[c] & RI_HEAD))
|
||||||
# define ri_head(c) (c < 0x100 && (class_tab[c] & RI_HEAD))
|
#define ri_alpha(c) (c < 0x100 && (class_tab[c] & RI_ALPHA))
|
||||||
# define ri_alpha(c) (c < 0x100 && (class_tab[c] & RI_ALPHA))
|
#define ri_lower(c) (c < 0x100 && (class_tab[c] & RI_LOWER))
|
||||||
# define ri_lower(c) (c < 0x100 && (class_tab[c] & RI_LOWER))
|
#define ri_upper(c) (c < 0x100 && (class_tab[c] & RI_UPPER))
|
||||||
# define ri_upper(c) (c < 0x100 && (class_tab[c] & RI_UPPER))
|
#define ri_white(c) (c < 0x100 && (class_tab[c] & RI_WHITE))
|
||||||
# define ri_white(c) (c < 0x100 && (class_tab[c] & RI_WHITE))
|
|
||||||
#else
|
|
||||||
# define ri_digit(c) (class_tab[c] & RI_DIGIT)
|
|
||||||
# define ri_hex(c) (class_tab[c] & RI_HEX)
|
|
||||||
# define ri_octal(c) (class_tab[c] & RI_OCTAL)
|
|
||||||
# define ri_word(c) (class_tab[c] & RI_WORD)
|
|
||||||
# define ri_head(c) (class_tab[c] & RI_HEAD)
|
|
||||||
# define ri_alpha(c) (class_tab[c] & RI_ALPHA)
|
|
||||||
# define ri_lower(c) (class_tab[c] & RI_LOWER)
|
|
||||||
# define ri_upper(c) (class_tab[c] & RI_UPPER)
|
|
||||||
# define ri_white(c) (class_tab[c] & RI_WHITE)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* flags for regflags */
|
/* flags for regflags */
|
||||||
#define RF_ICASE 1 /* ignore case */
|
#define RF_ICASE 1 /* ignore case */
|
||||||
@@ -698,21 +684,13 @@ static char_u *regconcat(int *flagp);
|
|||||||
static char_u *regpiece(int *);
|
static char_u *regpiece(int *);
|
||||||
static char_u *regatom(int *);
|
static char_u *regatom(int *);
|
||||||
static char_u *regnode(int);
|
static char_u *regnode(int);
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
static int use_multibytecode(int c);
|
static int use_multibytecode(int c);
|
||||||
#endif
|
|
||||||
static int prog_magic_wrong(void);
|
static int prog_magic_wrong(void);
|
||||||
static char_u *regnext(char_u *);
|
static char_u *regnext(char_u *);
|
||||||
static void regc(int b);
|
static void regc(int b);
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
static void regmbc(int c);
|
static void regmbc(int c);
|
||||||
# define REGMBC(x) regmbc(x);
|
#define REGMBC(x) regmbc(x);
|
||||||
# define CASEMBC(x) case x:
|
#define CASEMBC(x) case x:
|
||||||
#else
|
|
||||||
# define regmbc(c) regc(c)
|
|
||||||
# define REGMBC(x)
|
|
||||||
# define CASEMBC(x)
|
|
||||||
#endif
|
|
||||||
static void reginsert(int, char_u *);
|
static void reginsert(int, char_u *);
|
||||||
static void reginsert_nr(int op, long val, char_u *opnd);
|
static void reginsert_nr(int op, long val, char_u *opnd);
|
||||||
static void reginsert_limits(int, long, long, char_u *);
|
static void reginsert_limits(int, long, long, char_u *);
|
||||||
@@ -747,17 +725,13 @@ get_equi_class(char_u **pp)
|
|||||||
|
|
||||||
if (p[1] == '=')
|
if (p[1] == '=')
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
l = (*mb_ptr2len)(p + 2);
|
l = (*mb_ptr2len)(p + 2);
|
||||||
#endif
|
|
||||||
if (p[l + 2] == '=' && p[l + 3] == ']')
|
if (p[l + 2] == '=' && p[l + 3] == ']')
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
c = mb_ptr2char(p + 2);
|
c = mb_ptr2char(p + 2);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
c = p[2];
|
c = p[2];
|
||||||
*pp += l + 4;
|
*pp += l + 4;
|
||||||
return c;
|
return c;
|
||||||
@@ -798,10 +772,8 @@ char *EQUIVAL_CLASS_C[16] = {
|
|||||||
static void
|
static void
|
||||||
reg_equi_class(int c)
|
reg_equi_class(int c)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_utf8 || STRCMP(p_enc, "latin1") == 0
|
if (enc_utf8 || STRCMP(p_enc, "latin1") == 0
|
||||||
|| STRCMP(p_enc, "iso-8859-15") == 0)
|
|| STRCMP(p_enc, "iso-8859-15") == 0)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef EBCDIC
|
#ifdef EBCDIC
|
||||||
int i;
|
int i;
|
||||||
@@ -1134,17 +1106,13 @@ get_coll_element(char_u **pp)
|
|||||||
|
|
||||||
if (p[0] != NUL && p[1] == '.')
|
if (p[0] != NUL && p[1] == '.')
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
l = (*mb_ptr2len)(p + 2);
|
l = (*mb_ptr2len)(p + 2);
|
||||||
#endif
|
|
||||||
if (p[l + 2] == '.' && p[l + 3] == ']')
|
if (p[l + 2] == '.' && p[l + 3] == ']')
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
c = mb_ptr2char(p + 2);
|
c = mb_ptr2char(p + 2);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
c = p[2];
|
c = p[2];
|
||||||
*pp += l + 4;
|
*pp += l + 4;
|
||||||
return c;
|
return c;
|
||||||
@@ -1171,9 +1139,7 @@ get_cpo_flags(void)
|
|||||||
static char_u *
|
static char_u *
|
||||||
skip_anyof(char_u *p)
|
skip_anyof(char_u *p)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
int l;
|
int l;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (*p == '^') /* Complement of range. */
|
if (*p == '^') /* Complement of range. */
|
||||||
++p;
|
++p;
|
||||||
@@ -1181,11 +1147,9 @@ skip_anyof(char_u *p)
|
|||||||
++p;
|
++p;
|
||||||
while (*p != NUL && *p != ']')
|
while (*p != NUL && *p != ']')
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
|
if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
|
||||||
p += l;
|
p += l;
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
if (*p == '-')
|
if (*p == '-')
|
||||||
{
|
{
|
||||||
++p;
|
++p;
|
||||||
@@ -1395,11 +1359,9 @@ bt_regcomp(char_u *expr, int re_flags)
|
|||||||
|
|
||||||
if (OP(scan) == EXACTLY)
|
if (OP(scan) == EXACTLY)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
r->regstart = (*mb_ptr2char)(OPERAND(scan));
|
r->regstart = (*mb_ptr2char)(OPERAND(scan));
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
r->regstart = *OPERAND(scan);
|
r->regstart = *OPERAND(scan);
|
||||||
}
|
}
|
||||||
else if ((OP(scan) == BOW
|
else if ((OP(scan) == BOW
|
||||||
@@ -1409,11 +1371,9 @@ bt_regcomp(char_u *expr, int re_flags)
|
|||||||
|| OP(scan) == MCLOSE + 0 || OP(scan) == NCLOSE)
|
|| OP(scan) == MCLOSE + 0 || OP(scan) == NCLOSE)
|
||||||
&& OP(regnext(scan)) == EXACTLY)
|
&& OP(regnext(scan)) == EXACTLY)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
r->regstart = (*mb_ptr2char)(OPERAND(regnext(scan)));
|
r->regstart = (*mb_ptr2char)(OPERAND(regnext(scan)));
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
r->regstart = *OPERAND(regnext(scan));
|
r->regstart = *OPERAND(regnext(scan));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1696,9 +1656,7 @@ regconcat(int *flagp)
|
|||||||
cont = FALSE;
|
cont = FALSE;
|
||||||
break;
|
break;
|
||||||
case Magic('Z'):
|
case Magic('Z'):
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
regflags |= RF_ICOMBINE;
|
regflags |= RF_ICOMBINE;
|
||||||
#endif
|
|
||||||
skipchr_keepstart();
|
skipchr_keepstart();
|
||||||
break;
|
break;
|
||||||
case Magic('c'):
|
case Magic('c'):
|
||||||
@@ -2008,7 +1966,7 @@ regatom(int *flagp)
|
|||||||
p = vim_strchr(classchars, no_Magic(c));
|
p = vim_strchr(classchars, no_Magic(c));
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
EMSG_RET_NULL(_("E63: invalid use of \\_"));
|
EMSG_RET_NULL(_("E63: invalid use of \\_"));
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* When '.' is followed by a composing char ignore the dot, so that
|
/* When '.' is followed by a composing char ignore the dot, so that
|
||||||
* the composing char is matched here. */
|
* the composing char is matched here. */
|
||||||
if (enc_utf8 && c == Magic('.') && utf_iscomposing(peekchr()))
|
if (enc_utf8 && c == Magic('.') && utf_iscomposing(peekchr()))
|
||||||
@@ -2016,7 +1974,6 @@ regatom(int *flagp)
|
|||||||
c = getchr();
|
c = getchr();
|
||||||
goto do_multibyte;
|
goto do_multibyte;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
ret = regnode(classcodes[p - classchars] + extra);
|
ret = regnode(classcodes[p - classchars] + extra);
|
||||||
*flagp |= HASWIDTH | SIMPLE;
|
*flagp |= HASWIDTH | SIMPLE;
|
||||||
break;
|
break;
|
||||||
@@ -2268,20 +2225,14 @@ regatom(int *flagp)
|
|||||||
EMSG2_RET_NULL(
|
EMSG2_RET_NULL(
|
||||||
_("E678: Invalid character after %s%%[dxouU]"),
|
_("E678: Invalid character after %s%%[dxouU]"),
|
||||||
reg_magic == MAGIC_ALL);
|
reg_magic == MAGIC_ALL);
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (use_multibytecode(i))
|
if (use_multibytecode(i))
|
||||||
ret = regnode(MULTIBYTECODE);
|
ret = regnode(MULTIBYTECODE);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
ret = regnode(EXACTLY);
|
ret = regnode(EXACTLY);
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
regc(0x0a);
|
regc(0x0a);
|
||||||
else
|
else
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
regmbc(i);
|
regmbc(i);
|
||||||
#else
|
|
||||||
regc(i);
|
|
||||||
#endif
|
|
||||||
regc(NUL);
|
regc(NUL);
|
||||||
*flagp |= HASWIDTH;
|
*flagp |= HASWIDTH;
|
||||||
break;
|
break;
|
||||||
@@ -2403,11 +2354,9 @@ collection:
|
|||||||
endc = get_coll_element(®parse);
|
endc = get_coll_element(®parse);
|
||||||
if (endc == 0)
|
if (endc == 0)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
endc = mb_ptr2char_adv(®parse);
|
endc = mb_ptr2char_adv(®parse);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
endc = *regparse++;
|
endc = *regparse++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2417,7 +2366,6 @@ collection:
|
|||||||
|
|
||||||
if (startc > endc)
|
if (startc > endc)
|
||||||
EMSG_RET_NULL(_(e_reverse_range));
|
EMSG_RET_NULL(_(e_reverse_range));
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte && ((*mb_char2len)(startc) > 1
|
if (has_mbyte && ((*mb_char2len)(startc) > 1
|
||||||
|| (*mb_char2len)(endc) > 1))
|
|| (*mb_char2len)(endc) > 1))
|
||||||
{
|
{
|
||||||
@@ -2428,7 +2376,6 @@ collection:
|
|||||||
regmbc(startc);
|
regmbc(startc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef EBCDIC
|
#ifdef EBCDIC
|
||||||
int alpha_only = FALSE;
|
int alpha_only = FALSE;
|
||||||
@@ -2488,11 +2435,7 @@ collection:
|
|||||||
if (startc == 0)
|
if (startc == 0)
|
||||||
regc(0x0a);
|
regc(0x0a);
|
||||||
else
|
else
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
regmbc(startc);
|
regmbc(startc);
|
||||||
#else
|
|
||||||
regc(startc);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2606,7 +2549,6 @@ collection:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
@@ -2621,7 +2563,6 @@ collection:
|
|||||||
regc(*regparse++);
|
regc(*regparse++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
startc = *regparse++;
|
startc = *regparse++;
|
||||||
regc(startc);
|
regc(startc);
|
||||||
@@ -2645,7 +2586,6 @@ collection:
|
|||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* A multi-byte character is handled as a separate atom if it's
|
/* A multi-byte character is handled as a separate atom if it's
|
||||||
* before a multi and when it's a composing char. */
|
* before a multi and when it's a composing char. */
|
||||||
if (use_multibytecode(c))
|
if (use_multibytecode(c))
|
||||||
@@ -2656,7 +2596,6 @@ do_multibyte:
|
|||||||
*flagp |= HASWIDTH | SIMPLE;
|
*flagp |= HASWIDTH | SIMPLE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
ret = regnode(EXACTLY);
|
ret = regnode(EXACTLY);
|
||||||
|
|
||||||
@@ -2675,7 +2614,6 @@ do_multibyte:
|
|||||||
&& !is_Magic(c))); ++len)
|
&& !is_Magic(c))); ++len)
|
||||||
{
|
{
|
||||||
c = no_Magic(c);
|
c = no_Magic(c);
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
{
|
{
|
||||||
regmbc(c);
|
regmbc(c);
|
||||||
@@ -2695,7 +2633,6 @@ do_multibyte:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
regc(c);
|
regc(c);
|
||||||
c = getchr();
|
c = getchr();
|
||||||
}
|
}
|
||||||
@@ -2712,7 +2649,6 @@ do_multibyte:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/*
|
/*
|
||||||
* Return TRUE if MULTIBYTECODE should be used instead of EXACTLY for
|
* Return TRUE if MULTIBYTECODE should be used instead of EXACTLY for
|
||||||
* character "c".
|
* character "c".
|
||||||
@@ -2724,7 +2660,6 @@ use_multibytecode(int c)
|
|||||||
&& (re_multi_type(peekchr()) != NOT_MULTI
|
&& (re_multi_type(peekchr()) != NOT_MULTI
|
||||||
|| (enc_utf8 && utf_iscomposing(c)));
|
|| (enc_utf8 && utf_iscomposing(c)));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Emit a node.
|
* Emit a node.
|
||||||
@@ -2759,7 +2694,6 @@ regc(int b)
|
|||||||
*regcode++ = b;
|
*regcode++ = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/*
|
/*
|
||||||
* Emit (if appropriate) a multi-byte character of code
|
* Emit (if appropriate) a multi-byte character of code
|
||||||
*/
|
*/
|
||||||
@@ -2773,7 +2707,6 @@ regmbc(int c)
|
|||||||
else
|
else
|
||||||
regcode += (*mb_char2bytes)(c, regcode);
|
regcode += (*mb_char2bytes)(c, regcode);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insert an operator in front of already-emitted operand
|
* Insert an operator in front of already-emitted operand
|
||||||
@@ -3139,21 +3072,17 @@ peekchr(void)
|
|||||||
* Next character can never be (made) magic?
|
* Next character can never be (made) magic?
|
||||||
* Then backslashing it won't do anything.
|
* Then backslashing it won't do anything.
|
||||||
*/
|
*/
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
curchr = (*mb_ptr2char)(regparse + 1);
|
curchr = (*mb_ptr2char)(regparse + 1);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
curchr = c;
|
curchr = c;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
default:
|
default:
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
curchr = (*mb_ptr2char)(regparse);
|
curchr = (*mb_ptr2char)(regparse);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3173,14 +3102,12 @@ skipchr(void)
|
|||||||
prevchr_len = 0;
|
prevchr_len = 0;
|
||||||
if (regparse[prevchr_len] != NUL)
|
if (regparse[prevchr_len] != NUL)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_utf8)
|
if (enc_utf8)
|
||||||
/* exclude composing chars that mb_ptr2len does include */
|
/* exclude composing chars that mb_ptr2len does include */
|
||||||
prevchr_len += utf_ptr2len(regparse + prevchr_len);
|
prevchr_len += utf_ptr2len(regparse + prevchr_len);
|
||||||
else if (has_mbyte)
|
else if (has_mbyte)
|
||||||
prevchr_len += (*mb_ptr2len)(regparse + prevchr_len);
|
prevchr_len += (*mb_ptr2len)(regparse + prevchr_len);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
++prevchr_len;
|
++prevchr_len;
|
||||||
}
|
}
|
||||||
regparse += prevchr_len;
|
regparse += prevchr_len;
|
||||||
@@ -3538,11 +3465,9 @@ typedef struct {
|
|||||||
* contains '\c' or '\C' the value is overruled. */
|
* contains '\c' or '\C' the value is overruled. */
|
||||||
int reg_ic;
|
int reg_ic;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* Similar to "reg_ic", but only for 'combining' characters. Set with \Z
|
/* Similar to "reg_ic", but only for 'combining' characters. Set with \Z
|
||||||
* flag in the regexp. Defaults to false, always. */
|
* flag in the regexp. Defaults to false, always. */
|
||||||
int reg_icombine;
|
int reg_icombine;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Copy of "rmm_maxcol": maximum column to search for a match. Zero when
|
/* Copy of "rmm_maxcol": maximum column to search for a match. Zero when
|
||||||
* there is no maximum. */
|
* there is no maximum. */
|
||||||
@@ -3714,9 +3639,7 @@ bt_regexec_nl(
|
|||||||
rex.reg_buf = curbuf;
|
rex.reg_buf = curbuf;
|
||||||
rex.reg_win = NULL;
|
rex.reg_win = NULL;
|
||||||
rex.reg_ic = rmp->rm_ic;
|
rex.reg_ic = rmp->rm_ic;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
rex.reg_icombine = FALSE;
|
rex.reg_icombine = FALSE;
|
||||||
#endif
|
|
||||||
rex.reg_maxcol = 0;
|
rex.reg_maxcol = 0;
|
||||||
|
|
||||||
return bt_regexec_both(line, col, NULL, NULL);
|
return bt_regexec_both(line, col, NULL, NULL);
|
||||||
@@ -3748,9 +3671,7 @@ bt_regexec_multi(
|
|||||||
rex.reg_maxline = rex.reg_buf->b_ml.ml_line_count - lnum;
|
rex.reg_maxline = rex.reg_buf->b_ml.ml_line_count - lnum;
|
||||||
rex.reg_line_lbr = FALSE;
|
rex.reg_line_lbr = FALSE;
|
||||||
rex.reg_ic = rmp->rmm_ic;
|
rex.reg_ic = rmp->rmm_ic;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
rex.reg_icombine = FALSE;
|
rex.reg_icombine = FALSE;
|
||||||
#endif
|
|
||||||
rex.reg_maxcol = rmp->rmm_maxcol;
|
rex.reg_maxcol = rmp->rmm_maxcol;
|
||||||
|
|
||||||
return bt_regexec_both(NULL, col, tm, timed_out);
|
return bt_regexec_both(NULL, col, tm, timed_out);
|
||||||
@@ -3827,22 +3748,18 @@ bt_regexec_both(
|
|||||||
else if (prog->regflags & RF_NOICASE)
|
else if (prog->regflags & RF_NOICASE)
|
||||||
rex.reg_ic = FALSE;
|
rex.reg_ic = FALSE;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* If pattern contains "\Z" overrule value of rex.reg_icombine */
|
/* If pattern contains "\Z" overrule value of rex.reg_icombine */
|
||||||
if (prog->regflags & RF_ICOMBINE)
|
if (prog->regflags & RF_ICOMBINE)
|
||||||
rex.reg_icombine = TRUE;
|
rex.reg_icombine = TRUE;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If there is a "must appear" string, look for it. */
|
/* If there is a "must appear" string, look for it. */
|
||||||
if (prog->regmust != NULL)
|
if (prog->regmust != NULL)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
c = (*mb_ptr2char)(prog->regmust);
|
c = (*mb_ptr2char)(prog->regmust);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
c = *prog->regmust;
|
c = *prog->regmust;
|
||||||
s = line + col;
|
s = line + col;
|
||||||
|
|
||||||
@@ -3850,18 +3767,13 @@ bt_regexec_both(
|
|||||||
* This is used very often, esp. for ":global". Use three versions of
|
* This is used very often, esp. for ":global". Use three versions of
|
||||||
* the loop to avoid overhead of conditions.
|
* the loop to avoid overhead of conditions.
|
||||||
*/
|
*/
|
||||||
if (!rex.reg_ic
|
if (!rex.reg_ic && !has_mbyte)
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
&& !has_mbyte
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
while ((s = vim_strbyte(s, c)) != NULL)
|
while ((s = vim_strbyte(s, c)) != NULL)
|
||||||
{
|
{
|
||||||
if (cstrncmp(s, prog->regmust, &prog->regmlen) == 0)
|
if (cstrncmp(s, prog->regmust, &prog->regmlen) == 0)
|
||||||
break; /* Found it. */
|
break; /* Found it. */
|
||||||
++s;
|
++s;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
else if (!rex.reg_ic || (!enc_utf8 && mb_char2len(c) > 1))
|
else if (!rex.reg_ic || (!enc_utf8 && mb_char2len(c) > 1))
|
||||||
while ((s = vim_strchr(s, c)) != NULL)
|
while ((s = vim_strchr(s, c)) != NULL)
|
||||||
{
|
{
|
||||||
@@ -3869,7 +3781,6 @@ bt_regexec_both(
|
|||||||
break; /* Found it. */
|
break; /* Found it. */
|
||||||
MB_PTR_ADV(s);
|
MB_PTR_ADV(s);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
while ((s = cstrchr(s, c)) != NULL)
|
while ((s = cstrchr(s, c)) != NULL)
|
||||||
{
|
{
|
||||||
@@ -3890,19 +3801,15 @@ bt_regexec_both(
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
c = (*mb_ptr2char)(rex.line + col);
|
c = (*mb_ptr2char)(rex.line + col);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
c = rex.line[col];
|
c = rex.line[col];
|
||||||
if (prog->regstart == NUL
|
if (prog->regstart == NUL
|
||||||
|| prog->regstart == c
|
|| prog->regstart == c
|
||||||
|| (rex.reg_ic && ((
|
|| (rex.reg_ic
|
||||||
#ifdef FEAT_MBYTE
|
&& (((enc_utf8 && utf_fold(prog->regstart) == utf_fold(c)))
|
||||||
(enc_utf8 && utf_fold(prog->regstart) == utf_fold(c)))
|
|
||||||
|| (c < 255 && prog->regstart < 255 &&
|
|| (c < 255 && prog->regstart < 255 &&
|
||||||
#endif
|
|
||||||
MB_TOLOWER(prog->regstart) == MB_TOLOWER(c)))))
|
MB_TOLOWER(prog->regstart) == MB_TOLOWER(c)))))
|
||||||
retval = regtry(prog, col, tm, timed_out);
|
retval = regtry(prog, col, tm, timed_out);
|
||||||
else
|
else
|
||||||
@@ -3920,11 +3827,7 @@ bt_regexec_both(
|
|||||||
{
|
{
|
||||||
/* Skip until the char we know it must start with.
|
/* Skip until the char we know it must start with.
|
||||||
* Used often, do some work to avoid call overhead. */
|
* Used often, do some work to avoid call overhead. */
|
||||||
if (!rex.reg_ic
|
if (!rex.reg_ic && !has_mbyte)
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
&& !has_mbyte
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
s = vim_strbyte(rex.line + col, prog->regstart);
|
s = vim_strbyte(rex.line + col, prog->regstart);
|
||||||
else
|
else
|
||||||
s = cstrchr(rex.line + col, prog->regstart);
|
s = cstrchr(rex.line + col, prog->regstart);
|
||||||
@@ -3955,11 +3858,9 @@ bt_regexec_both(
|
|||||||
}
|
}
|
||||||
if (rex.line[col] == NUL)
|
if (rex.line[col] == NUL)
|
||||||
break;
|
break;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
col += (*mb_ptr2len)(rex.line + col);
|
col += (*mb_ptr2len)(rex.line + col);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
++col;
|
++col;
|
||||||
#ifdef FEAT_RELTIME
|
#ifdef FEAT_RELTIME
|
||||||
/* Check for timeout once in a twenty times to avoid overhead. */
|
/* Check for timeout once in a twenty times to avoid overhead. */
|
||||||
@@ -4116,7 +4017,6 @@ regtry(
|
|||||||
return 1 + rex.lnum;
|
return 1 + rex.lnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/*
|
/*
|
||||||
* Get class of previous character.
|
* Get class of previous character.
|
||||||
*/
|
*/
|
||||||
@@ -4128,7 +4028,6 @@ reg_prev_class(void)
|
|||||||
- (*mb_head_off)(rex.line, rex.input - 1), rex.reg_buf);
|
- (*mb_head_off)(rex.line, rex.input - 1), rex.reg_buf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return TRUE if the current rex.input position matches the Visual area.
|
* Return TRUE if the current rex.input position matches the Visual area.
|
||||||
@@ -4339,11 +4238,9 @@ regmatch(
|
|||||||
{
|
{
|
||||||
if (WITH_NL(op))
|
if (WITH_NL(op))
|
||||||
op -= ADD_NL;
|
op -= ADD_NL;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
c = (*mb_ptr2char)(rex.input);
|
c = (*mb_ptr2char)(rex.input);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
c = *rex.input;
|
c = *rex.input;
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
@@ -4431,7 +4328,6 @@ regmatch(
|
|||||||
case BOW: /* \<word; rex.input points to w */
|
case BOW: /* \<word; rex.input points to w */
|
||||||
if (c == NUL) /* Can't match at end of line */
|
if (c == NUL) /* Can't match at end of line */
|
||||||
status = RA_NOMATCH;
|
status = RA_NOMATCH;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
else if (has_mbyte)
|
else if (has_mbyte)
|
||||||
{
|
{
|
||||||
int this_class;
|
int this_class;
|
||||||
@@ -4443,7 +4339,6 @@ regmatch(
|
|||||||
else if (reg_prev_class() == this_class)
|
else if (reg_prev_class() == this_class)
|
||||||
status = RA_NOMATCH; /* previous char is in same word */
|
status = RA_NOMATCH; /* previous char is in same word */
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!vim_iswordc_buf(c, rex.reg_buf) || (rex.input > rex.line
|
if (!vim_iswordc_buf(c, rex.reg_buf) || (rex.input > rex.line
|
||||||
@@ -4455,7 +4350,6 @@ regmatch(
|
|||||||
case EOW: /* word\>; rex.input points after d */
|
case EOW: /* word\>; rex.input points after d */
|
||||||
if (rex.input == rex.line) /* Can't match at start of line */
|
if (rex.input == rex.line) /* Can't match at start of line */
|
||||||
status = RA_NOMATCH;
|
status = RA_NOMATCH;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
else if (has_mbyte)
|
else if (has_mbyte)
|
||||||
{
|
{
|
||||||
int this_class, prev_class;
|
int this_class, prev_class;
|
||||||
@@ -4467,7 +4361,6 @@ regmatch(
|
|||||||
|| prev_class == 0 || prev_class == 1)
|
|| prev_class == 0 || prev_class == 1)
|
||||||
status = RA_NOMATCH;
|
status = RA_NOMATCH;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!vim_iswordc_buf(rex.input[-1], rex.reg_buf)
|
if (!vim_iswordc_buf(rex.input[-1], rex.reg_buf)
|
||||||
@@ -4676,11 +4569,9 @@ regmatch(
|
|||||||
opnd = OPERAND(scan);
|
opnd = OPERAND(scan);
|
||||||
/* Inline the first byte, for speed. */
|
/* Inline the first byte, for speed. */
|
||||||
if (*opnd != *rex.input
|
if (*opnd != *rex.input
|
||||||
&& (!rex.reg_ic || (
|
&& (!rex.reg_ic
|
||||||
#ifdef FEAT_MBYTE
|
|| (!enc_utf8
|
||||||
!enc_utf8 &&
|
&& MB_TOLOWER(*opnd) != MB_TOLOWER(*rex.input))))
|
||||||
#endif
|
|
||||||
MB_TOLOWER(*opnd) != MB_TOLOWER(*rex.input))))
|
|
||||||
status = RA_NOMATCH;
|
status = RA_NOMATCH;
|
||||||
else if (*opnd == NUL)
|
else if (*opnd == NUL)
|
||||||
{
|
{
|
||||||
@@ -4689,11 +4580,7 @@ regmatch(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (opnd[1] == NUL
|
if (opnd[1] == NUL && !(enc_utf8 && rex.reg_ic))
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
&& !(enc_utf8 && rex.reg_ic)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
len = 1; /* matched a single byte above */
|
len = 1; /* matched a single byte above */
|
||||||
}
|
}
|
||||||
@@ -4704,7 +4591,6 @@ regmatch(
|
|||||||
if (cstrncmp(opnd, rex.input, &len) != 0)
|
if (cstrncmp(opnd, rex.input, &len) != 0)
|
||||||
status = RA_NOMATCH;
|
status = RA_NOMATCH;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* Check for following composing character, unless %C
|
/* Check for following composing character, unless %C
|
||||||
* follows (skips over all composing chars). */
|
* follows (skips over all composing chars). */
|
||||||
if (status != RA_NOMATCH
|
if (status != RA_NOMATCH
|
||||||
@@ -4718,7 +4604,6 @@ regmatch(
|
|||||||
* for voweled Hebrew texts. */
|
* for voweled Hebrew texts. */
|
||||||
status = RA_NOMATCH;
|
status = RA_NOMATCH;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (status != RA_NOMATCH)
|
if (status != RA_NOMATCH)
|
||||||
rex.input += len;
|
rex.input += len;
|
||||||
}
|
}
|
||||||
@@ -4735,7 +4620,6 @@ regmatch(
|
|||||||
ADVANCE_REGINPUT();
|
ADVANCE_REGINPUT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
case MULTIBYTECODE:
|
case MULTIBYTECODE:
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
{
|
{
|
||||||
@@ -4788,16 +4672,13 @@ regmatch(
|
|||||||
else
|
else
|
||||||
status = RA_NOMATCH;
|
status = RA_NOMATCH;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case RE_COMPOSING:
|
case RE_COMPOSING:
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_utf8)
|
if (enc_utf8)
|
||||||
{
|
{
|
||||||
/* Skip composing characters. */
|
/* Skip composing characters. */
|
||||||
while (utf_iscomposing(utf_ptr2char(rex.input)))
|
while (utf_iscomposing(utf_ptr2char(rex.input)))
|
||||||
MB_CPTR_ADV(rex.input);
|
MB_CPTR_ADV(rex.input);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NOTHING:
|
case NOTHING:
|
||||||
@@ -5561,7 +5442,6 @@ regmatch(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
{
|
{
|
||||||
char_u *line =
|
char_u *line =
|
||||||
@@ -5572,7 +5452,6 @@ regmatch(
|
|||||||
+ rp->rs_un.regsave.rs_u.pos.col - 1) + 1;
|
+ rp->rs_un.regsave.rs_u.pos.col - 1) + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
--rp->rs_un.regsave.rs_u.pos.col;
|
--rp->rs_un.regsave.rs_u.pos.col;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5952,9 +5831,8 @@ regrepeat(
|
|||||||
do_class:
|
do_class:
|
||||||
while (count < maxcount)
|
while (count < maxcount)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
int l;
|
int l;
|
||||||
#endif
|
|
||||||
if (*scan == NUL)
|
if (*scan == NUL)
|
||||||
{
|
{
|
||||||
if (!REG_MULTI || !WITH_NL(OP(p)) || rex.lnum > rex.reg_maxline
|
if (!REG_MULTI || !WITH_NL(OP(p)) || rex.lnum > rex.reg_maxline
|
||||||
@@ -5965,14 +5843,12 @@ do_class:
|
|||||||
if (got_int)
|
if (got_int)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
else if (has_mbyte && (l = (*mb_ptr2len)(scan)) > 1)
|
else if (has_mbyte && (l = (*mb_ptr2len)(scan)) > 1)
|
||||||
{
|
{
|
||||||
if (testval != 0)
|
if (testval != 0)
|
||||||
break;
|
break;
|
||||||
scan += l;
|
scan += l;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else if ((class_tab[*scan] & mask) == testval)
|
else if ((class_tab[*scan] & mask) == testval)
|
||||||
++scan;
|
++scan;
|
||||||
else if (rex.reg_line_lbr && *scan == '\n' && WITH_NL(OP(p)))
|
else if (rex.reg_line_lbr && *scan == '\n' && WITH_NL(OP(p)))
|
||||||
@@ -6081,7 +5957,6 @@ do_class:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
case MULTIBYTECODE:
|
case MULTIBYTECODE:
|
||||||
{
|
{
|
||||||
int i, len, cf = 0;
|
int i, len, cf = 0;
|
||||||
@@ -6106,7 +5981,6 @@ do_class:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case ANYOF:
|
case ANYOF:
|
||||||
case ANYOF + ADD_NL:
|
case ANYOF + ADD_NL:
|
||||||
@@ -6117,9 +5991,8 @@ do_class:
|
|||||||
case ANYBUT + ADD_NL:
|
case ANYBUT + ADD_NL:
|
||||||
while (count < maxcount)
|
while (count < maxcount)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
int len;
|
int len;
|
||||||
#endif
|
|
||||||
if (*scan == NUL)
|
if (*scan == NUL)
|
||||||
{
|
{
|
||||||
if (!REG_MULTI || !WITH_NL(OP(p)) || rex.lnum > rex.reg_maxline
|
if (!REG_MULTI || !WITH_NL(OP(p)) || rex.lnum > rex.reg_maxline
|
||||||
@@ -6132,14 +6005,12 @@ do_class:
|
|||||||
}
|
}
|
||||||
else if (rex.reg_line_lbr && *scan == '\n' && WITH_NL(OP(p)))
|
else if (rex.reg_line_lbr && *scan == '\n' && WITH_NL(OP(p)))
|
||||||
++scan;
|
++scan;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
else if (has_mbyte && (len = (*mb_ptr2len)(scan)) > 1)
|
else if (has_mbyte && (len = (*mb_ptr2len)(scan)) > 1)
|
||||||
{
|
{
|
||||||
if ((cstrchr(opnd, (*mb_ptr2char)(scan)) == NULL) == testval)
|
if ((cstrchr(opnd, (*mb_ptr2char)(scan)) == NULL) == testval)
|
||||||
break;
|
break;
|
||||||
scan += len;
|
scan += len;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((cstrchr(opnd, *scan) == NULL) == testval)
|
if ((cstrchr(opnd, *scan) == NULL) == testval)
|
||||||
@@ -6955,11 +6826,9 @@ regprop(char_u *op)
|
|||||||
sprintf(buf + STRLEN(buf), "BRACE_COMPLEX%d", OP(op) - BRACE_COMPLEX);
|
sprintf(buf + STRLEN(buf), "BRACE_COMPLEX%d", OP(op) - BRACE_COMPLEX);
|
||||||
p = NULL;
|
p = NULL;
|
||||||
break;
|
break;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
case MULTIBYTECODE:
|
case MULTIBYTECODE:
|
||||||
p = "MULTIBYTECODE";
|
p = "MULTIBYTECODE";
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case NEWL:
|
case NEWL:
|
||||||
p = "NEWL";
|
p = "NEWL";
|
||||||
break;
|
break;
|
||||||
@@ -6989,7 +6858,6 @@ re_mult_next(char *what)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int a, b, c;
|
int a, b, c;
|
||||||
@@ -7067,7 +6935,6 @@ mb_decompose(int c, int *c1, int *c2, int *c3)
|
|||||||
*c2 = *c3 = 0;
|
*c2 = *c3 = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compare two strings, ignore case if rex.reg_ic set.
|
* Compare two strings, ignore case if rex.reg_ic set.
|
||||||
@@ -7084,7 +6951,6 @@ cstrncmp(char_u *s1, char_u *s2, int *n)
|
|||||||
else
|
else
|
||||||
result = MB_STRNICMP(s1, s2, *n);
|
result = MB_STRNICMP(s1, s2, *n);
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* if it failed and it's utf8 and we want to combineignore: */
|
/* if it failed and it's utf8 and we want to combineignore: */
|
||||||
if (result != 0 && enc_utf8 && rex.reg_icombine)
|
if (result != 0 && enc_utf8 && rex.reg_icombine)
|
||||||
{
|
{
|
||||||
@@ -7121,7 +6987,6 @@ cstrncmp(char_u *s1, char_u *s2, int *n)
|
|||||||
if (result == 0)
|
if (result == 0)
|
||||||
*n = (int)(str2 - s2);
|
*n = (int)(str2 - s2);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -7135,21 +7000,15 @@ cstrchr(char_u *s, int c)
|
|||||||
char_u *p;
|
char_u *p;
|
||||||
int cc;
|
int cc;
|
||||||
|
|
||||||
if (!rex.reg_ic
|
if (!rex.reg_ic || (!enc_utf8 && mb_char2len(c) > 1))
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
|| (!enc_utf8 && mb_char2len(c) > 1)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
return vim_strchr(s, c);
|
return vim_strchr(s, c);
|
||||||
|
|
||||||
/* tolower() and toupper() can be slow, comparing twice should be a lot
|
/* tolower() and toupper() can be slow, comparing twice should be a lot
|
||||||
* faster (esp. when using MS Visual C++!).
|
* faster (esp. when using MS Visual C++!).
|
||||||
* For UTF-8 need to use folded case. */
|
* For UTF-8 need to use folded case. */
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_utf8 && c > 0x80)
|
if (enc_utf8 && c > 0x80)
|
||||||
cc = utf_fold(c);
|
cc = utf_fold(c);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
if (MB_ISUPPER(c))
|
if (MB_ISUPPER(c))
|
||||||
cc = MB_TOLOWER(c);
|
cc = MB_TOLOWER(c);
|
||||||
else if (MB_ISLOWER(c))
|
else if (MB_ISLOWER(c))
|
||||||
@@ -7157,7 +7016,6 @@ cstrchr(char_u *s, int c)
|
|||||||
else
|
else
|
||||||
return vim_strchr(s, c);
|
return vim_strchr(s, c);
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
{
|
{
|
||||||
for (p = s; *p != NUL; p += (*mb_ptr2len)(p))
|
for (p = s; *p != NUL; p += (*mb_ptr2len)(p))
|
||||||
@@ -7172,7 +7030,6 @@ cstrchr(char_u *s, int c)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
/* Faster version for when there are no multi-byte characters. */
|
/* Faster version for when there are no multi-byte characters. */
|
||||||
for (p = s; *p != NUL; ++p)
|
for (p = s; *p != NUL; ++p)
|
||||||
if (*p == c || *p == cc)
|
if (*p == c || *p == cc)
|
||||||
@@ -7285,10 +7142,8 @@ regtilde(char_u *source, int magic)
|
|||||||
{
|
{
|
||||||
if (*p == '\\' && p[1]) /* skip escaped characters */
|
if (*p == '\\' && p[1]) /* skip escaped characters */
|
||||||
++p;
|
++p;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
p += (*mb_ptr2len)(p) - 1;
|
p += (*mb_ptr2len)(p) - 1;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7682,10 +7537,8 @@ vim_regsub_both(
|
|||||||
c = *src++;
|
c = *src++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
else if (has_mbyte)
|
else if (has_mbyte)
|
||||||
c = mb_ptr2char(src - 1);
|
c = mb_ptr2char(src - 1);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Write to buffer, if copy is set. */
|
/* Write to buffer, if copy is set. */
|
||||||
if (func_one != (fptr_T)NULL)
|
if (func_one != (fptr_T)NULL)
|
||||||
@@ -7697,7 +7550,6 @@ vim_regsub_both(
|
|||||||
else /* just copy */
|
else /* just copy */
|
||||||
cc = c;
|
cc = c;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
{
|
{
|
||||||
int totlen = mb_ptr2len(src - 1);
|
int totlen = mb_ptr2len(src - 1);
|
||||||
@@ -7721,9 +7573,7 @@ vim_regsub_both(
|
|||||||
}
|
}
|
||||||
src += totlen - 1;
|
src += totlen - 1;
|
||||||
}
|
}
|
||||||
else
|
else if (copy)
|
||||||
#endif
|
|
||||||
if (copy)
|
|
||||||
*dst = cc;
|
*dst = cc;
|
||||||
dst++;
|
dst++;
|
||||||
}
|
}
|
||||||
@@ -7799,11 +7649,9 @@ vim_regsub_both(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
c = mb_ptr2char(s);
|
c = mb_ptr2char(s);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
c = *s;
|
c = *s;
|
||||||
|
|
||||||
if (func_one != (fptr_T)NULL)
|
if (func_one != (fptr_T)NULL)
|
||||||
@@ -7815,7 +7663,6 @@ vim_regsub_both(
|
|||||||
else /* just copy */
|
else /* just copy */
|
||||||
cc = c;
|
cc = c;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
@@ -7833,9 +7680,7 @@ vim_regsub_both(
|
|||||||
mb_char2bytes(cc, dst);
|
mb_char2bytes(cc, dst);
|
||||||
dst += mb_char2len(cc) - 1;
|
dst += mb_char2len(cc) - 1;
|
||||||
}
|
}
|
||||||
else
|
else if (copy)
|
||||||
#endif
|
|
||||||
if (copy)
|
|
||||||
*dst = cc;
|
*dst = cc;
|
||||||
dst++;
|
dst++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -487,11 +487,9 @@ nfa_get_match_text(nfa_state_T *start)
|
|||||||
s = ret;
|
s = ret;
|
||||||
while (p->c > 0)
|
while (p->c > 0)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
s += (*mb_char2bytes)(p->c, s);
|
s += (*mb_char2bytes)(p->c, s);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
*s++ = p->c;
|
*s++ = p->c;
|
||||||
p = p->out;
|
p = p->out;
|
||||||
}
|
}
|
||||||
@@ -687,16 +685,10 @@ nfa_recognize_char_class(char_u *start, char_u *end, int extra_newl)
|
|||||||
nfa_emit_equi_class(int c)
|
nfa_emit_equi_class(int c)
|
||||||
{
|
{
|
||||||
#define EMIT2(c) EMIT(c); EMIT(NFA_CONCAT);
|
#define EMIT2(c) EMIT(c); EMIT(NFA_CONCAT);
|
||||||
#ifdef FEAT_MBYTE
|
#define EMITMBC(c) EMIT(c); EMIT(NFA_CONCAT);
|
||||||
# define EMITMBC(c) EMIT(c); EMIT(NFA_CONCAT);
|
|
||||||
#else
|
|
||||||
# define EMITMBC(c)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_utf8 || STRCMP(p_enc, "latin1") == 0
|
if (enc_utf8 || STRCMP(p_enc, "latin1") == 0
|
||||||
|| STRCMP(p_enc, "iso-8859-15") == 0)
|
|| STRCMP(p_enc, "iso-8859-15") == 0)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef EBCDIC
|
#ifdef EBCDIC
|
||||||
# define A_circumflex 0x62
|
# define A_circumflex 0x62
|
||||||
@@ -1203,9 +1195,7 @@ nfa_regatom(void)
|
|||||||
int got_coll_char;
|
int got_coll_char;
|
||||||
char_u *p;
|
char_u *p;
|
||||||
char_u *endp;
|
char_u *endp;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
char_u *old_regparse = regparse;
|
char_u *old_regparse = regparse;
|
||||||
#endif
|
|
||||||
int extra = 0;
|
int extra = 0;
|
||||||
int emit_range;
|
int emit_range;
|
||||||
int negated;
|
int negated;
|
||||||
@@ -1310,7 +1300,7 @@ nfa_regatom(void)
|
|||||||
siemsg("INTERNAL: Unknown character class char: %d", c);
|
siemsg("INTERNAL: Unknown character class char: %d", c);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* When '.' is followed by a composing char ignore the dot, so that
|
/* When '.' is followed by a composing char ignore the dot, so that
|
||||||
* the composing char is matched here. */
|
* the composing char is matched here. */
|
||||||
if (enc_utf8 && c == Magic('.') && utf_iscomposing(peekchr()))
|
if (enc_utf8 && c == Magic('.') && utf_iscomposing(peekchr()))
|
||||||
@@ -1319,7 +1309,6 @@ nfa_regatom(void)
|
|||||||
c = getchr();
|
c = getchr();
|
||||||
goto nfa_do_multibyte;
|
goto nfa_do_multibyte;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
EMIT(nfa_classcodes[p - classchars]);
|
EMIT(nfa_classcodes[p - classchars]);
|
||||||
if (extra == NFA_ADD_NL)
|
if (extra == NFA_ADD_NL)
|
||||||
{
|
{
|
||||||
@@ -1827,9 +1816,7 @@ collection:
|
|||||||
EMIT(NFA_RANGE);
|
EMIT(NFA_RANGE);
|
||||||
EMIT(NFA_CONCAT);
|
EMIT(NFA_CONCAT);
|
||||||
}
|
}
|
||||||
else
|
else if (has_mbyte && ((*mb_char2len)(startc) > 1
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte && ((*mb_char2len)(startc) > 1
|
|
||||||
|| (*mb_char2len)(endc) > 1))
|
|| (*mb_char2len)(endc) > 1))
|
||||||
{
|
{
|
||||||
/* Emit the characters in the range.
|
/* Emit the characters in the range.
|
||||||
@@ -1842,7 +1829,6 @@ collection:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef EBCDIC
|
#ifdef EBCDIC
|
||||||
int alpha_only = FALSE;
|
int alpha_only = FALSE;
|
||||||
@@ -1929,7 +1915,6 @@ collection:
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
int plen;
|
int plen;
|
||||||
|
|
||||||
nfa_do_multibyte:
|
nfa_do_multibyte:
|
||||||
@@ -1961,7 +1946,6 @@ nfa_do_multibyte:
|
|||||||
regparse = old_regparse + plen;
|
regparse = old_regparse + plen;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
c = no_Magic(c);
|
c = no_Magic(c);
|
||||||
EMIT(c);
|
EMIT(c);
|
||||||
@@ -2211,9 +2195,7 @@ nfa_regconcat(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Magic('Z'):
|
case Magic('Z'):
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
regflags |= RF_ICOMBINE;
|
regflags |= RF_ICOMBINE;
|
||||||
#endif
|
|
||||||
skipchr_keepstart();
|
skipchr_keepstart();
|
||||||
break;
|
break;
|
||||||
case Magic('c'):
|
case Magic('c'):
|
||||||
@@ -2996,13 +2978,11 @@ nfa_max_width(nfa_state_T *startstate, int depth)
|
|||||||
case NFA_START_COLL:
|
case NFA_START_COLL:
|
||||||
case NFA_START_NEG_COLL:
|
case NFA_START_NEG_COLL:
|
||||||
/* matches some character, including composing chars */
|
/* matches some character, including composing chars */
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_utf8)
|
if (enc_utf8)
|
||||||
len += MB_MAXBYTES;
|
len += MB_MAXBYTES;
|
||||||
else if (has_mbyte)
|
else if (has_mbyte)
|
||||||
len += 2;
|
len += 2;
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
++len;
|
++len;
|
||||||
if (state->c != NFA_ANY)
|
if (state->c != NFA_ANY)
|
||||||
{
|
{
|
||||||
@@ -3048,11 +3028,9 @@ nfa_max_width(nfa_state_T *startstate, int depth)
|
|||||||
case NFA_NUPPER_IC:
|
case NFA_NUPPER_IC:
|
||||||
case NFA_ANY_COMPOSING:
|
case NFA_ANY_COMPOSING:
|
||||||
/* possibly non-ascii */
|
/* possibly non-ascii */
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
len += 3;
|
len += 3;
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
++len;
|
++len;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -3501,7 +3479,6 @@ post2nfa(int *postfix, int *end, int nfa_calc_size)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
case NFA_COMPOSING: /* char with composing char */
|
case NFA_COMPOSING: /* char with composing char */
|
||||||
#if 0
|
#if 0
|
||||||
/* TODO */
|
/* TODO */
|
||||||
@@ -3511,7 +3488,6 @@ post2nfa(int *postfix, int *end, int nfa_calc_size)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
#endif
|
|
||||||
|
|
||||||
case NFA_MOPEN: /* \( \) Submatch */
|
case NFA_MOPEN: /* \( \) Submatch */
|
||||||
case NFA_MOPEN1:
|
case NFA_MOPEN1:
|
||||||
@@ -3558,9 +3534,7 @@ post2nfa(int *postfix, int *end, int nfa_calc_size)
|
|||||||
case NFA_ZOPEN8: mclose = NFA_ZCLOSE8; break;
|
case NFA_ZOPEN8: mclose = NFA_ZCLOSE8; break;
|
||||||
case NFA_ZOPEN9: mclose = NFA_ZCLOSE9; break;
|
case NFA_ZOPEN9: mclose = NFA_ZCLOSE9; break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
case NFA_COMPOSING: mclose = NFA_END_COMPOSING; break;
|
case NFA_COMPOSING: mclose = NFA_END_COMPOSING; break;
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
/* NFA_MOPEN, NFA_MOPEN1 .. NFA_MOPEN9 */
|
/* NFA_MOPEN, NFA_MOPEN1 .. NFA_MOPEN9 */
|
||||||
mclose = *p + NSUBEXP;
|
mclose = *p + NSUBEXP;
|
||||||
@@ -3596,11 +3570,9 @@ post2nfa(int *postfix, int *end, int nfa_calc_size)
|
|||||||
goto theend;
|
goto theend;
|
||||||
patch(e.out, s1);
|
patch(e.out, s1);
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (mopen == NFA_COMPOSING)
|
if (mopen == NFA_COMPOSING)
|
||||||
/* COMPOSING->out1 = END_COMPOSING */
|
/* COMPOSING->out1 = END_COMPOSING */
|
||||||
patch(list1(&s->out1), s1);
|
patch(list1(&s->out1), s1);
|
||||||
#endif
|
|
||||||
|
|
||||||
PUSH(frag(s, list1(&s1->out)));
|
PUSH(frag(s, list1(&s1->out)));
|
||||||
break;
|
break;
|
||||||
@@ -5119,10 +5091,8 @@ recursive_regmatch(
|
|||||||
if ((int)(rex.input - rex.line) >= state->val)
|
if ((int)(rex.input - rex.line) >= state->val)
|
||||||
{
|
{
|
||||||
rex.input -= state->val;
|
rex.input -= state->val;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
rex.input -= mb_head_off(rex.line, rex.input);
|
rex.input -= mb_head_off(rex.line, rex.input);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rex.input = rex.line;
|
rex.input = rex.line;
|
||||||
@@ -5381,11 +5351,7 @@ skip_to_start(int c, colnr_T *colp)
|
|||||||
char_u *s;
|
char_u *s;
|
||||||
|
|
||||||
/* Used often, do some work to avoid call overhead. */
|
/* Used often, do some work to avoid call overhead. */
|
||||||
if (!rex.reg_ic
|
if (!rex.reg_ic && !has_mbyte)
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
&& !has_mbyte
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
s = vim_strbyte(rex.line + *colp, c);
|
s = vim_strbyte(rex.line + *colp, c);
|
||||||
else
|
else
|
||||||
s = cstrchr(rex.line + *colp, c);
|
s = cstrchr(rex.line + *colp, c);
|
||||||
@@ -5424,12 +5390,9 @@ find_match_text(colnr_T startcol, int regstart, char_u *match_text)
|
|||||||
len2 += MB_CHAR2LEN(c2);
|
len2 += MB_CHAR2LEN(c2);
|
||||||
}
|
}
|
||||||
if (match
|
if (match
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* check that no composing char follows */
|
/* check that no composing char follows */
|
||||||
&& !(enc_utf8
|
&& !(enc_utf8
|
||||||
&& utf_iscomposing(PTR2CHAR(rex.line + col + len2)))
|
&& utf_iscomposing(PTR2CHAR(rex.line + col + len2))))
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
cleanup_subexpr();
|
cleanup_subexpr();
|
||||||
if (REG_MULTI)
|
if (REG_MULTI)
|
||||||
@@ -5596,14 +5559,12 @@ nfa_regmatch(
|
|||||||
int curc;
|
int curc;
|
||||||
int clen;
|
int clen;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
{
|
{
|
||||||
curc = (*mb_ptr2char)(rex.input);
|
curc = (*mb_ptr2char)(rex.input);
|
||||||
clen = (*mb_ptr2len)(rex.input);
|
clen = (*mb_ptr2len)(rex.input);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
curc = *rex.input;
|
curc = *rex.input;
|
||||||
clen = 1;
|
clen = 1;
|
||||||
@@ -5708,12 +5669,11 @@ nfa_regmatch(
|
|||||||
{
|
{
|
||||||
case NFA_MATCH:
|
case NFA_MATCH:
|
||||||
{
|
{
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* If the match ends before a composing characters and
|
/* If the match ends before a composing characters and
|
||||||
* rex.reg_icombine is not set, that is not really a match. */
|
* rex.reg_icombine is not set, that is not really a match. */
|
||||||
if (enc_utf8 && !rex.reg_icombine && utf_iscomposing(curc))
|
if (enc_utf8 && !rex.reg_icombine && utf_iscomposing(curc))
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
nfa_match = TRUE;
|
nfa_match = TRUE;
|
||||||
copy_sub(&submatch->norm, &t->subs.norm);
|
copy_sub(&submatch->norm, &t->subs.norm);
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
@@ -6024,7 +5984,6 @@ nfa_regmatch(
|
|||||||
|
|
||||||
if (curc == NUL)
|
if (curc == NUL)
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
else if (has_mbyte)
|
else if (has_mbyte)
|
||||||
{
|
{
|
||||||
int this_class;
|
int this_class;
|
||||||
@@ -6036,7 +5995,6 @@ nfa_regmatch(
|
|||||||
else if (reg_prev_class() == this_class)
|
else if (reg_prev_class() == this_class)
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else if (!vim_iswordc_buf(curc, rex.reg_buf)
|
else if (!vim_iswordc_buf(curc, rex.reg_buf)
|
||||||
|| (rex.input > rex.line
|
|| (rex.input > rex.line
|
||||||
&& vim_iswordc_buf(rex.input[-1], rex.reg_buf)))
|
&& vim_iswordc_buf(rex.input[-1], rex.reg_buf)))
|
||||||
@@ -6052,7 +6010,6 @@ nfa_regmatch(
|
|||||||
result = TRUE;
|
result = TRUE;
|
||||||
if (rex.input == rex.line)
|
if (rex.input == rex.line)
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
else if (has_mbyte)
|
else if (has_mbyte)
|
||||||
{
|
{
|
||||||
int this_class, prev_class;
|
int this_class, prev_class;
|
||||||
@@ -6064,7 +6021,6 @@ nfa_regmatch(
|
|||||||
|| prev_class == 0 || prev_class == 1)
|
|| prev_class == 0 || prev_class == 1)
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else if (!vim_iswordc_buf(rex.input[-1], rex.reg_buf)
|
else if (!vim_iswordc_buf(rex.input[-1], rex.reg_buf)
|
||||||
|| (rex.input[0] != NUL
|
|| (rex.input[0] != NUL
|
||||||
&& vim_iswordc_buf(curc, rex.reg_buf)))
|
&& vim_iswordc_buf(curc, rex.reg_buf)))
|
||||||
@@ -6093,7 +6049,6 @@ nfa_regmatch(
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
case NFA_COMPOSING:
|
case NFA_COMPOSING:
|
||||||
{
|
{
|
||||||
int mc = curc;
|
int mc = curc;
|
||||||
@@ -6169,7 +6124,6 @@ nfa_regmatch(
|
|||||||
ADD_STATE_IF_MATCH(end);
|
ADD_STATE_IF_MATCH(end);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
case NFA_NEWL:
|
case NFA_NEWL:
|
||||||
if (curc == NUL && !rex.reg_line_lbr && REG_MULTI
|
if (curc == NUL && !rex.reg_line_lbr && REG_MULTI
|
||||||
@@ -6274,13 +6228,11 @@ nfa_regmatch(
|
|||||||
case NFA_ANY_COMPOSING:
|
case NFA_ANY_COMPOSING:
|
||||||
/* On a composing character skip over it. Otherwise do
|
/* On a composing character skip over it. Otherwise do
|
||||||
* nothing. Always matches. */
|
* nothing. Always matches. */
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
if (enc_utf8 && utf_iscomposing(curc))
|
if (enc_utf8 && utf_iscomposing(curc))
|
||||||
{
|
{
|
||||||
add_off = clen;
|
add_off = clen;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
add_here = TRUE;
|
add_here = TRUE;
|
||||||
add_off = 0;
|
add_off = 0;
|
||||||
@@ -6562,10 +6514,7 @@ nfa_regmatch(
|
|||||||
/* Bail out quickly when there can't be a match, avoid the
|
/* Bail out quickly when there can't be a match, avoid the
|
||||||
* overhead of win_linetabsize() on long lines. */
|
* overhead of win_linetabsize() on long lines. */
|
||||||
if (op != 1 && col > t->state->val
|
if (op != 1 && col > t->state->val
|
||||||
#ifdef FEAT_MBYTE
|
* (has_mbyte ? MB_MAXBYTES : 1))
|
||||||
* (has_mbyte ? MB_MAXBYTES : 1)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
break;
|
break;
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
if (op == 1 && col - 1 > t->state->val && col > 100)
|
if (op == 1 && col - 1 > t->state->val && col > 100)
|
||||||
@@ -6676,12 +6625,10 @@ nfa_regmatch(
|
|||||||
|
|
||||||
if (!result && rex.reg_ic)
|
if (!result && rex.reg_ic)
|
||||||
result = MB_TOLOWER(c) == MB_TOLOWER(curc);
|
result = MB_TOLOWER(c) == MB_TOLOWER(curc);
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* If rex.reg_icombine is not set only skip over the character
|
/* If rex.reg_icombine is not set only skip over the character
|
||||||
* itself. When it is set skip over composing characters. */
|
* itself. When it is set skip over composing characters. */
|
||||||
if (result && enc_utf8 && !rex.reg_icombine)
|
if (result && enc_utf8 && !rex.reg_icombine)
|
||||||
clen = utf_ptr2len(rex.input);
|
clen = utf_ptr2len(rex.input);
|
||||||
#endif
|
|
||||||
ADD_STATE_IF_MATCH(t->state);
|
ADD_STATE_IF_MATCH(t->state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -7104,11 +7051,9 @@ nfa_regexec_both(
|
|||||||
else if (prog->regflags & RF_NOICASE)
|
else if (prog->regflags & RF_NOICASE)
|
||||||
rex.reg_ic = FALSE;
|
rex.reg_ic = FALSE;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
/* If pattern contains "\Z" overrule value of rex.reg_icombine */
|
/* If pattern contains "\Z" overrule value of rex.reg_icombine */
|
||||||
if (prog->regflags & RF_ICOMBINE)
|
if (prog->regflags & RF_ICOMBINE)
|
||||||
rex.reg_icombine = TRUE;
|
rex.reg_icombine = TRUE;
|
||||||
#endif
|
|
||||||
|
|
||||||
rex.line = line;
|
rex.line = line;
|
||||||
rex.lnum = 0; /* relative to line */
|
rex.lnum = 0; /* relative to line */
|
||||||
@@ -7149,11 +7094,7 @@ nfa_regexec_both(
|
|||||||
|
|
||||||
/* If match_text is set it contains the full text that must match.
|
/* If match_text is set it contains the full text that must match.
|
||||||
* Nothing else to try. Doesn't handle combining chars well. */
|
* Nothing else to try. Doesn't handle combining chars well. */
|
||||||
if (prog->match_text != NULL
|
if (prog->match_text != NULL && !rex.reg_icombine)
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
&& !rex.reg_icombine
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
return find_match_text(col, prog->regstart, prog->match_text);
|
return find_match_text(col, prog->regstart, prog->match_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7334,9 +7275,7 @@ nfa_regexec_nl(
|
|||||||
rex.reg_buf = curbuf;
|
rex.reg_buf = curbuf;
|
||||||
rex.reg_win = NULL;
|
rex.reg_win = NULL;
|
||||||
rex.reg_ic = rmp->rm_ic;
|
rex.reg_ic = rmp->rm_ic;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
rex.reg_icombine = FALSE;
|
rex.reg_icombine = FALSE;
|
||||||
#endif
|
|
||||||
rex.reg_maxcol = 0;
|
rex.reg_maxcol = 0;
|
||||||
return nfa_regexec_both(line, col, NULL, NULL);
|
return nfa_regexec_both(line, col, NULL, NULL);
|
||||||
}
|
}
|
||||||
@@ -7385,9 +7324,7 @@ nfa_regexec_multi(
|
|||||||
rex.reg_maxline = rex.reg_buf->b_ml.ml_line_count - lnum;
|
rex.reg_maxline = rex.reg_buf->b_ml.ml_line_count - lnum;
|
||||||
rex.reg_line_lbr = FALSE;
|
rex.reg_line_lbr = FALSE;
|
||||||
rex.reg_ic = rmp->rmm_ic;
|
rex.reg_ic = rmp->rmm_ic;
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
rex.reg_icombine = FALSE;
|
rex.reg_icombine = FALSE;
|
||||||
#endif
|
|
||||||
rex.reg_maxcol = rmp->rmm_maxcol;
|
rex.reg_maxcol = rmp->rmm_maxcol;
|
||||||
|
|
||||||
return nfa_regexec_both(NULL, col, tm, timed_out);
|
return nfa_regexec_both(NULL, col, tm, timed_out);
|
||||||
|
|||||||
327
src/screen.c
327
src/screen.c
File diff suppressed because it is too large
Load Diff
@@ -791,6 +791,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
809,
|
||||||
/**/
|
/**/
|
||||||
808,
|
808,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user