Skip to content

Commit a5f6013

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents eff6659 + 79cdf80 commit a5f6013

21 files changed

Lines changed: 293 additions & 128 deletions

runtime/filetype.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,7 @@ au BufNewFile,BufRead *.pml setf promela
13051305

13061306
" Google protocol buffers
13071307
au BufNewFile,BufRead *.proto setf proto
1308+
au BufNewFile,BufRead *.pbtxt setf pbtxt
13081309

13091310
" Protocols
13101311
au BufNewFile,BufRead */etc/protocols setf protocols

src/GvimExt/gvimext.cpp

Lines changed: 11 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ static char *null_libintl_bindtextdomain(const char *, const char *);
161161
static int dyn_libintl_init(char *dir);
162162
static void dyn_libintl_end(void);
163163

164-
static wchar_t *oldenv = NULL;
165164
static HINSTANCE hLibintlDLL = 0;
166165
static char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext;
167166
static char *(*dyn_libintl_textdomain)(const char *) = null_libintl_textdomain;
@@ -205,17 +204,17 @@ dyn_libintl_init(char *dir)
205204
if (buf != NULL && buf2 != NULL)
206205
{
207206
GetEnvironmentVariableW(L"PATH", buf, len);
208-
#ifdef _WIN64
207+
# ifdef _WIN64
209208
_snwprintf(buf2, len2, L"%S\\GvimExt64;%s", dir, buf);
210-
#else
209+
# else
211210
_snwprintf(buf2, len2, L"%S\\GvimExt32;%s", dir, buf);
212-
#endif
211+
# endif
213212
SetEnvironmentVariableW(L"PATH", buf2);
214213
hLibintlDLL = LoadLibrary(GETTEXT_DLL);
215-
#ifdef GETTEXT_DLL_ALT
214+
# ifdef GETTEXT_DLL_ALT
216215
if (!hLibintlDLL)
217216
hLibintlDLL = LoadLibrary(GETTEXT_DLL_ALT);
218-
#endif
217+
# endif
219218
SetEnvironmentVariableW(L"PATH", buf);
220219
}
221220
free(buf);
@@ -273,56 +272,7 @@ null_libintl_textdomain(const char* /* domainname */)
273272
dyn_gettext_load(void)
274273
{
275274
char szBuff[BUFSIZE];
276-
char szLang[BUFSIZE];
277275
DWORD len;
278-
HKEY keyhandle;
279-
int gotlang = 0;
280-
281-
strcpy(szLang, "LANG=");
282-
283-
// First try getting the language from the registry, this can be
284-
// used to overrule the system language.
285-
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
286-
KEY_READ, &keyhandle) == ERROR_SUCCESS)
287-
{
288-
len = BUFSIZE;
289-
if (RegQueryValueEx(keyhandle, "lang", 0, NULL, (BYTE*)szBuff, &len)
290-
== ERROR_SUCCESS)
291-
{
292-
szBuff[len] = 0;
293-
strcat(szLang, szBuff);
294-
gotlang = 1;
295-
}
296-
RegCloseKey(keyhandle);
297-
}
298-
299-
if (!gotlang && getenv("LANG") == NULL)
300-
{
301-
// Get the language from the system.
302-
// Could use LOCALE_SISO639LANGNAME, but it's not in Win95.
303-
// LOCALE_SABBREVLANGNAME gives us three letters, like "enu", we use
304-
// only the first two.
305-
len = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME,
306-
(LPTSTR)szBuff, BUFSIZE);
307-
if (len >= 2 && _strnicmp(szBuff, "en", 2) != 0)
308-
{
309-
// There are a few exceptions (probably more)
310-
if (_strnicmp(szBuff, "cht", 3) == 0
311-
|| _strnicmp(szBuff, "zht", 3) == 0)
312-
strcpy(szBuff, "zh_TW");
313-
else if (_strnicmp(szBuff, "chs", 3) == 0
314-
|| _strnicmp(szBuff, "zhc", 3) == 0)
315-
strcpy(szBuff, "zh_CN");
316-
else if (_strnicmp(szBuff, "jp", 2) == 0)
317-
strcpy(szBuff, "ja");
318-
else
319-
szBuff[2] = 0; // truncate to two-letter code
320-
strcat(szLang, szBuff);
321-
gotlang = 1;
322-
}
323-
}
324-
if (gotlang)
325-
putenv(szLang);
326276

327277
// Try to locate the runtime files. The path is used to find libintl.dll
328278
// and the vim.mo files.
@@ -378,10 +328,8 @@ DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /* lpReserved */)
378328
inc_cRefThisDLL()
379329
{
380330
#ifdef FEAT_GETTEXT
381-
if (g_cRefThisDll == 0) {
331+
if (g_cRefThisDll == 0)
382332
dyn_gettext_load();
383-
oldenv = GetEnvironmentStringsW();
384-
}
385333
#endif
386334
InterlockedIncrement((LPLONG)&g_cRefThisDll);
387335
}
@@ -390,13 +338,8 @@ inc_cRefThisDLL()
390338
dec_cRefThisDLL()
391339
{
392340
#ifdef FEAT_GETTEXT
393-
if (InterlockedDecrement((LPLONG)&g_cRefThisDll) == 0) {
341+
if (InterlockedDecrement((LPLONG)&g_cRefThisDll) == 0)
394342
dyn_gettext_free();
395-
if (oldenv != NULL) {
396-
FreeEnvironmentStringsW(oldenv);
397-
oldenv = NULL;
398-
}
399-
}
400343
#else
401344
InterlockedDecrement((LPLONG)&g_cRefThisDll);
402345
#endif
@@ -967,8 +910,8 @@ STDMETHODIMP CShellExt::InvokeGvim(HWND hParent,
967910
NULL, // Process handle not inheritable.
968911
NULL, // Thread handle not inheritable.
969912
FALSE, // Set handle inheritance to FALSE.
970-
oldenv == NULL ? 0 : CREATE_UNICODE_ENVIRONMENT,
971-
oldenv, // Use unmodified environment block.
913+
0, // No creation flags.
914+
NULL, // Use parent's environment block.
972915
NULL, // Use parent's starting directory.
973916
&si, // Pointer to STARTUPINFO structure.
974917
&pi) // Pointer to PROCESS_INFORMATION structure.
@@ -1057,8 +1000,8 @@ STDMETHODIMP CShellExt::InvokeSingleGvim(HWND hParent,
10571000
NULL, // Process handle not inheritable.
10581001
NULL, // Thread handle not inheritable.
10591002
FALSE, // Set handle inheritance to FALSE.
1060-
oldenv == NULL ? 0 : CREATE_UNICODE_ENVIRONMENT,
1061-
oldenv, // Use unmodified environment block.
1003+
0, // No creation flags.
1004+
NULL, // Use parent's environment block.
10621005
NULL, // Use parent's starting directory.
10631006
&si, // Pointer to STARTUPINFO structure.
10641007
&pi) // Pointer to PROCESS_INFORMATION structure.

src/drawline.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,16 +2446,18 @@ win_line(
24462446
&& conceal_cursor_line(wp)
24472447
&& (int)wp->w_virtcol <= vcol + n_skip)
24482448
{
2449-
# ifdef FEAT_RIGHTLEFT
2449+
# ifdef FEAT_RIGHTLEFT
24502450
if (wp->w_p_rl)
24512451
wp->w_wcol = wp->w_width - col + boguscols - 1;
24522452
else
2453-
# endif
2453+
# endif
24542454
wp->w_wcol = col - boguscols;
24552455
wp->w_wrow = row;
24562456
did_wcol = TRUE;
24572457
curwin->w_valid |= VALID_WCOL|VALID_WROW|VALID_VIRTCOL;
2458+
# ifdef FEAT_PROP_POPUP
24582459
curwin->w_flags &= ~(WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED);
2460+
# endif
24592461
}
24602462
#endif
24612463

src/errors.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,5 @@ EXTERN char e_cmd_mapping_must_end_with_cr_before_second_cmd[]
301301
INIT(=N_("E1136: <Cmd> mapping must end with <CR> before second <Cmd>"));
302302
EXTERN char e_cmd_maping_must_not_include_str_key[]
303303
INIT(= N_("E1137: <Cmd> mapping must not include %s key"));
304+
EXTERN char e_using_bool_as_number[]
305+
INIT(= N_("E1138: Using a Bool as a Number"));

src/getchar.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3704,11 +3704,7 @@ getcmdkeycmd(
37043704
else if (IS_SPECIAL(c1))
37053705
{
37063706
if (c1 == K_SNR)
3707-
{
3708-
ga_append(&line_ga, (char)K_SPECIAL);
3709-
ga_append(&line_ga, (char)KS_EXTRA);
3710-
ga_append(&line_ga, (char)KE_SNR);
3711-
}
3707+
ga_concat(&line_ga, (char_u *)"<SNR>");
37123708
else
37133709
{
37143710
semsg(e_cmd_maping_must_not_include_str_key,

src/gui_w32.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,10 @@ gui_mch_wait_for_chars(int wtime)
21342134
break;
21352135
}
21362136
else if (input_available()
2137-
|| MsgWaitForMultipleObjects(0, NULL, FALSE, 100,
2137+
// TODO: The 10 msec is a compromise between laggy response
2138+
// and consuming more CPU time. Better would be to handle
2139+
// channel messages when they arrive.
2140+
|| MsgWaitForMultipleObjects(0, NULL, FALSE, 10,
21382141
QS_ALLINPUT) != WAIT_TIMEOUT)
21392142
break;
21402143
}
@@ -8458,7 +8461,7 @@ make_tooltip(BalloonEval *beval, char *text, POINT pt)
84588461
TOOLINFOW *pti;
84598462
int ToolInfoSize;
84608463

8461-
if (multiline_balloon_available() == TRUE)
8464+
if (multiline_balloon_available())
84628465
ToolInfoSize = sizeof(TOOLINFOW_NEW);
84638466
else
84648467
ToolInfoSize = sizeof(TOOLINFOW);
@@ -8481,7 +8484,7 @@ make_tooltip(BalloonEval *beval, char *text, POINT pt)
84818484
pti->hinst = 0; // Don't use string resources
84828485
pti->uId = ID_BEVAL_TOOLTIP;
84838486

8484-
if (multiline_balloon_available() == TRUE)
8487+
if (multiline_balloon_available())
84858488
{
84868489
RECT rect;
84878490
TOOLINFOW_NEW *ptin = (TOOLINFOW_NEW *)pti;

src/ops.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3465,8 +3465,9 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
34653465
if ((redo_yank || oap->op_type != OP_YANK)
34663466
&& ((!VIsual_active || oap->motion_force)
34673467
// Also redo Operator-pending Visual mode mappings
3468-
|| (VIsual_active && cap->cmdchar == ':'
3469-
&& oap->op_type != OP_COLON))
3468+
|| (VIsual_active
3469+
&& (cap->cmdchar == ':' || cap->cmdchar == K_COMMAND)
3470+
&& oap->op_type != OP_COLON))
34703471
&& cap->cmdchar != 'D'
34713472
#ifdef FEAT_FOLDING
34723473
&& oap->op_type != OP_FOLD
@@ -3688,7 +3689,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
36883689
get_op_char(oap->op_type),
36893690
get_extra_op_char(oap->op_type),
36903691
oap->motion_force, cap->cmdchar, cap->nchar);
3691-
else if (cap->cmdchar != ':')
3692+
else if (cap->cmdchar != ':' && cap->cmdchar != K_COMMAND)
36923693
{
36933694
int nchar = oap->op_type == OP_REPLACE ? cap->nchar : NUL;
36943695

src/proto/userfunc.pro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ ufunc_T *find_func(char_u *name, int is_global, cctx_T *cctx);
1414
int func_is_global(ufunc_T *ufunc);
1515
int func_name_refcount(char_u *name);
1616
void copy_func(char_u *lambda, char_u *global);
17+
int funcdepth_increment(void);
18+
void funcdepth_decrement(void);
19+
int funcdepth_get(void);
20+
void funcdepth_restore(int depth);
1721
int call_user_func_check(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rettv, funcexe_T *funcexe, dict_T *selfdict);
1822
void save_funccal(funccal_entry_T *entry);
1923
void restore_funccal(void);

src/syntax.c

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3869,9 +3869,14 @@ syn_cmd_list(
38693869
msg_puts(_("no syncing"));
38703870
else
38713871
{
3872-
msg_puts(_("syncing starts "));
3873-
msg_outnum(curwin->w_s->b_syn_sync_minlines);
3874-
msg_puts(_(" lines before top line"));
3872+
if (curwin->w_s->b_syn_sync_minlines == MAXLNUM)
3873+
msg_puts(_("syncing starts at the first line"));
3874+
else
3875+
{
3876+
msg_puts(_("syncing starts "));
3877+
msg_outnum(curwin->w_s->b_syn_sync_minlines);
3878+
msg_puts(_(" lines before top line"));
3879+
}
38753880
syn_match_msg();
38763881
}
38773882
return;
@@ -3935,19 +3940,24 @@ syn_lines_msg(void)
39353940
|| curwin->w_s->b_syn_sync_minlines > 0)
39363941
{
39373942
msg_puts("; ");
3938-
if (curwin->w_s->b_syn_sync_minlines > 0)
3939-
{
3940-
msg_puts(_("minimal "));
3941-
msg_outnum(curwin->w_s->b_syn_sync_minlines);
3942-
if (curwin->w_s->b_syn_sync_maxlines)
3943-
msg_puts(", ");
3944-
}
3945-
if (curwin->w_s->b_syn_sync_maxlines > 0)
3943+
if (curwin->w_s->b_syn_sync_minlines == MAXLNUM)
3944+
msg_puts(_("from the first line"));
3945+
else
39463946
{
3947-
msg_puts(_("maximal "));
3948-
msg_outnum(curwin->w_s->b_syn_sync_maxlines);
3947+
if (curwin->w_s->b_syn_sync_minlines > 0)
3948+
{
3949+
msg_puts(_("minimal "));
3950+
msg_outnum(curwin->w_s->b_syn_sync_minlines);
3951+
if (curwin->w_s->b_syn_sync_maxlines)
3952+
msg_puts(", ");
3953+
}
3954+
if (curwin->w_s->b_syn_sync_maxlines > 0)
3955+
{
3956+
msg_puts(_("maximal "));
3957+
msg_outnum(curwin->w_s->b_syn_sync_maxlines);
3958+
}
3959+
msg_puts(_(" lines before top line"));
39493960
}
3950-
msg_puts(_(" lines before top line"));
39513961
}
39523962
}
39533963

src/testdir/test_filetype.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ let s:filename_checks = {
345345
\ 'papp': ['file.papp', 'file.pxml', 'file.pxsl'],
346346
\ 'pascal': ['file.pas', 'file.pp', 'file.dpr', 'file.lpr'],
347347
\ 'passwd': ['any/etc/passwd', 'any/etc/passwd-', 'any/etc/passwd.edit', 'any/etc/shadow', 'any/etc/shadow-', 'any/etc/shadow.edit', 'any/var/backups/passwd.bak', 'any/var/backups/shadow.bak', '/etc/passwd', '/etc/passwd-', '/etc/passwd.edit', '/etc/shadow', '/etc/shadow-', '/etc/shadow.edit', '/var/backups/passwd.bak', '/var/backups/shadow.bak'],
348+
\ 'pbtxt': ['file.pbtxt'],
348349
\ 'pccts': ['file.g'],
349350
\ 'pdf': ['file.pdf'],
350351
\ 'perl': ['file.plx', 'file.al', 'file.psgi', 'gitolite.rc', '.gitolite.rc', 'example.gitolite.rc'],

0 commit comments

Comments
 (0)