Skip to content

Commit 4ded3ab

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 7683f13 + 8b9e20a commit 4ded3ab

13 files changed

Lines changed: 268 additions & 86 deletions

File tree

Filelist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ RT_ALL = \
584584
runtime/doc/*.txt \
585585
runtime/doc/Makefile \
586586
runtime/doc/doctags.c \
587+
runtime/doc/test_urls.vim \
587588
runtime/doc/vim.1 \
588589
runtime/doc/evim.1 \
589590
runtime/doc/vimdiff.1 \

runtime/doc/test_urls.vim

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
" Test for URLs in help documents.
2+
"
3+
" Opens a new window with all found URLS followed by return code from curl
4+
" (anything other than 0 means unreachable)
5+
"
6+
" Written by Christian Brabandt.
7+
8+
func Test_check_URLs()
9+
if has("win32")
10+
echoerr "Doesn't work on MS-Windows"
11+
return
12+
endif
13+
if executable('curl')
14+
" Note: does not follow redirects!
15+
let s:command = 'curl --silent --fail --output /dev/null --head '
16+
elseif executable('wget')
17+
" Note: only allow a couple of redirects
18+
let s:command = 'wget --quiet -S --spider --max-redirect=2 --timeout=5 --tries=2 -O /dev/null '
19+
else
20+
echoerr 'Only works when "curl" or "wget" is available'
21+
return
22+
endif
23+
24+
let pat='\(https\?\|ftp\)://[^\t* ]\+'
25+
exe 'helpgrep' pat
26+
helpclose
27+
28+
let urls = map(getqflist(), 'v:val.text')
29+
" do not use submatch(1)!
30+
let urls = map(urls, {key, val -> matchstr(val, pat)})
31+
" remove examples like user@host (invalid urls)
32+
let urls = filter(urls, 'v:val !~ "@"')
33+
" Remove example URLs which are invalid
34+
let urls = filter(urls, {key, val -> val !~ '\<\(\(my\|some\)\?host\|machine\|hostname\|file\)\>'})
35+
new
36+
put =urls
37+
" remove some more invalid items
38+
" empty lines
39+
v/./d
40+
" remove # anchors
41+
%s/#.*$//e
42+
" remove trailing stuff (parenthesis, dot, comma, quotes), but only for HTTP
43+
" links
44+
g/^h/s#[.,)'"/>][:.]\?$##
45+
g#^[hf]t\?tp:/\(/\?\.*\)$#d
46+
silent! g/ftp://,$/d
47+
silent! g/=$/d
48+
let a = getline(1,'$')
49+
let a = uniq(sort(a))
50+
%d
51+
call setline(1, a)
52+
53+
" Do the testing.
54+
set nomore
55+
%s/.*/\=TestURL(submatch(0))/
56+
57+
" highlight the failures
58+
/.* \([0-9]*[1-9]\|[0-9]\{2,}\)$
59+
endfunc
60+
61+
func TestURL(url)
62+
" Relies on the return code to determine whether a page is valid
63+
echom printf("Testing URL: %d/%d %s", line('.'), line('$'), a:url)
64+
call system(s:command . shellescape(a:url))
65+
return printf("%s %d", a:url, v:shell_error)
66+
endfunc
67+
68+
call Test_check_URLs()

src/edit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ edit(
781781
#endif
782782

783783
/*
784-
* Get a character for Insert mode. Ignore K_IGNORE.
784+
* Get a character for Insert mode. Ignore K_IGNORE and K_NOP.
785785
*/
786786
if (c != K_CURSORHOLD)
787787
lastc = c; /* remember the previous char for CTRL-D */
@@ -798,7 +798,7 @@ edit(
798798
do
799799
{
800800
c = safe_vgetc();
801-
} while (c == K_IGNORE);
801+
} while (c == K_IGNORE || c == K_NOP);
802802

803803
#ifdef FEAT_AUTOCMD
804804
/* Don't want K_CURSORHOLD for the second key, e.g., after CTRL-V. */

src/ex_getln.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,12 +417,12 @@ getcmdline(
417417

418418
cursorcmd(); /* set the cursor on the right spot */
419419

420-
/* Get a character. Ignore K_IGNORE, it should not do anything, such
421-
* as stop completion. */
420+
/* Get a character. Ignore K_IGNORE and K_NOP, they should not do
421+
* anything, such as stop completion. */
422422
do
423423
{
424424
c = safe_vgetc();
425-
} while (c == K_IGNORE);
425+
} while (c == K_IGNORE || c == K_NOP);
426426

427427
if (KeyTyped)
428428
{

src/feature.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,8 @@
636636
/* #define FEAT_MBYTE_IME */
637637
# endif
638638

639-
#if defined(FEAT_MBYTE_IME) && !defined(FEAT_MBYTE)
639+
/* Input methods are only useful with +multi_byte. */
640+
#if (defined(FEAT_MBYTE_IME) || defined(FEAT_XIM)) && !defined(FEAT_MBYTE)
640641
# define FEAT_MBYTE
641642
#endif
642643

src/gui_w32.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,11 @@ static void TrackUserActivity(UINT uMsg);
498498
*
499499
* These LOGFONT used for IME.
500500
*/
501-
#ifdef FEAT_MBYTE
501+
#if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)
502502
/* holds LOGFONT for 'guifontwide' if available, otherwise 'guifont' */
503503
static LOGFONT norm_logfont;
504+
#endif
505+
#ifdef FEAT_MBYTE_IME
504506
/* holds LOGFONT for 'guifont' always. */
505507
static LOGFONT sub_logfont;
506508
#endif
@@ -3361,6 +3363,8 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED)
33613363
font_name = (char_u *)lf.lfFaceName;
33623364
#if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)
33633365
norm_logfont = lf;
3366+
#endif
3367+
#ifdef FEAT_MBYTE_IME
33643368
sub_logfont = lf;
33653369
#endif
33663370
#ifdef FEAT_MBYTE_IME
@@ -5794,15 +5798,15 @@ gui_mch_set_sp_color(guicolor_T color)
57945798
gui.currSpColor = color;
57955799
}
57965800

5797-
#if defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)
5801+
#ifdef FEAT_MBYTE_IME
57985802
/*
57995803
* Multi-byte handling, originally by Sung-Hoon Baek.
58005804
* First static functions (no prototypes generated).
58015805
*/
5802-
#ifdef _MSC_VER
5803-
# include <ime.h> /* Apparently not needed for Cygwin, MingW or Borland. */
5804-
#endif
5805-
#include <imm.h>
5806+
# ifdef _MSC_VER
5807+
# include <ime.h> /* Apparently not needed for Cygwin, MingW or Borland. */
5808+
# endif
5809+
# include <imm.h>
58065810

58075811
/*
58085812
* handle WM_IME_NOTIFY message
@@ -5954,7 +5958,7 @@ GetResultStr(HWND hwnd, int GCS, int *lenp)
59545958
#endif
59555959

59565960
/* For global functions we need prototypes. */
5957-
#if (defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)) || defined(PROTO)
5961+
#if defined(FEAT_MBYTE_IME) || defined(PROTO)
59585962

59595963
/*
59605964
* set font to IM.
@@ -6079,7 +6083,7 @@ im_get_status(void)
60796083
return status;
60806084
}
60816085

6082-
#endif /* FEAT_MBYTE && FEAT_MBYTE_IME */
6086+
#endif /* FEAT_MBYTE_IME */
60836087

60846088
#if defined(FEAT_MBYTE) && !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME)
60856089
/* Win32 with GLOBAL IME */

src/mbyte.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4790,7 +4790,7 @@ iconv_end(void)
47904790
# define USE_IMSTATUSFUNC (*p_imsf != NUL)
47914791
#endif
47924792

4793-
#ifdef FEAT_EVAL
4793+
#if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
47944794
static void
47954795
call_imactivatefunc(int active)
47964796
{
@@ -6562,7 +6562,7 @@ static int im_was_set_active = FALSE;
65626562
int
65636563
im_get_status()
65646564
{
6565-
# ifdef FEAT_EVAL
6565+
# if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
65666566
if (USE_IMSTATUSFUNC)
65676567
return call_imstatusfunc();
65686568
# endif

src/os_win32.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,7 +1789,6 @@ mch_inchar(
17891789
#endif
17901790
{
17911791
int n = 1;
1792-
int conv = FALSE;
17931792

17941793
#ifdef FEAT_MBYTE
17951794
if (ch2 == NUL)
@@ -1822,28 +1821,6 @@ mch_inchar(
18221821
n += 2;
18231822
}
18241823

1825-
if (conv)
1826-
{
1827-
char_u *p = typeahead + typeaheadlen;
1828-
1829-
if (*p != K_NUL)
1830-
{
1831-
char_u *e = typeahead + TYPEAHEADLEN;
1832-
1833-
while (*p && p < e)
1834-
{
1835-
if (*p == K_NUL)
1836-
{
1837-
++p;
1838-
mch_memmove(p + 1, p, ((size_t)(e - p)) - 1);
1839-
*p = 3;
1840-
++n;
1841-
}
1842-
++p;
1843-
}
1844-
}
1845-
}
1846-
18471824
/* Use the ALT key to set the 8th bit of the character
18481825
* when it's one byte, the 8th bit isn't set yet and not
18491826
* using a double-byte encoding (would become a lead

src/quickfix.c

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4055,6 +4055,7 @@ ex_cfile(exarg_T *eap)
40554055
#ifdef FEAT_AUTOCMD
40564056
char_u *au_name = NULL;
40574057
#endif
4058+
int res;
40584059

40594060
if (eap->cmdidx == CMD_lfile || eap->cmdidx == CMD_lgetfile
40604061
|| eap->cmdidx == CMD_laddfile)
@@ -4102,28 +4103,18 @@ ex_cfile(exarg_T *eap)
41024103
* :caddfile adds to an existing quickfix list. If there is no
41034104
* quickfix list then a new list is created.
41044105
*/
4105-
if (qf_init(wp, p_ef, p_efm, (eap->cmdidx != CMD_caddfile
4106-
&& eap->cmdidx != CMD_laddfile),
4107-
*eap->cmdlinep, enc) > 0
4108-
&& (eap->cmdidx == CMD_cfile
4109-
|| eap->cmdidx == CMD_lfile))
4110-
{
4106+
res = qf_init(wp, p_ef, p_efm, (eap->cmdidx != CMD_caddfile
4107+
&& eap->cmdidx != CMD_laddfile), *eap->cmdlinep, enc);
41114108
#ifdef FEAT_AUTOCMD
4112-
if (au_name != NULL)
4113-
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf);
4109+
if (au_name != NULL)
4110+
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf);
41144111
#endif
4112+
if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile))
4113+
{
41154114
if (wp != NULL)
41164115
qi = GET_LOC_LIST(wp);
41174116
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
41184117
}
4119-
4120-
else
4121-
{
4122-
#ifdef FEAT_AUTOCMD
4123-
if (au_name != NULL)
4124-
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf);
4125-
#endif
4126-
}
41274118
}
41284119

41294120
/*
@@ -5450,6 +5441,7 @@ ex_cbuffer(exarg_T *eap)
54505441
#ifdef FEAT_AUTOCMD
54515442
char_u *au_name = NULL;
54525443
#endif
5444+
int res;
54535445

54545446
if (eap->cmdidx == CMD_lbuffer || eap->cmdidx == CMD_lgetbuffer
54555447
|| eap->cmdidx == CMD_laddbuffer)
@@ -5509,20 +5501,19 @@ ex_cbuffer(exarg_T *eap)
55095501
qf_title = IObuff;
55105502
}
55115503

5512-
if (qf_init_ext(qi, qi->qf_curlist, NULL, buf, NULL, p_efm,
5504+
res = qf_init_ext(qi, qi->qf_curlist, NULL, buf, NULL, p_efm,
55135505
(eap->cmdidx != CMD_caddbuffer
55145506
&& eap->cmdidx != CMD_laddbuffer),
55155507
eap->line1, eap->line2,
5516-
qf_title, NULL) > 0)
5517-
{
5508+
qf_title, NULL);
55185509
#ifdef FEAT_AUTOCMD
5519-
if (au_name != NULL)
5520-
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
5521-
curbuf->b_fname, TRUE, curbuf);
5510+
if (au_name != NULL)
5511+
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
5512+
curbuf->b_fname, TRUE, curbuf);
55225513
#endif
5523-
if (eap->cmdidx == CMD_cbuffer || eap->cmdidx == CMD_lbuffer)
5524-
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
5525-
}
5514+
if (res > 0 && (eap->cmdidx == CMD_cbuffer ||
5515+
eap->cmdidx == CMD_lbuffer))
5516+
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
55265517
}
55275518
}
55285519
}
@@ -5540,6 +5531,7 @@ ex_cexpr(exarg_T *eap)
55405531
#ifdef FEAT_AUTOCMD
55415532
char_u *au_name = NULL;
55425533
#endif
5534+
int res;
55435535

55445536
if (eap->cmdidx == CMD_lexpr || eap->cmdidx == CMD_lgetexpr
55455537
|| eap->cmdidx == CMD_laddexpr)
@@ -5578,20 +5570,19 @@ ex_cexpr(exarg_T *eap)
55785570
if ((tv->v_type == VAR_STRING && tv->vval.v_string != NULL)
55795571
|| (tv->v_type == VAR_LIST && tv->vval.v_list != NULL))
55805572
{
5581-
if (qf_init_ext(qi, qi->qf_curlist, NULL, NULL, tv, p_efm,
5573+
res = qf_init_ext(qi, qi->qf_curlist, NULL, NULL, tv, p_efm,
55825574
(eap->cmdidx != CMD_caddexpr
55835575
&& eap->cmdidx != CMD_laddexpr),
55845576
(linenr_T)0, (linenr_T)0, *eap->cmdlinep,
5585-
NULL) > 0)
5586-
{
5577+
NULL);
55875578
#ifdef FEAT_AUTOCMD
5588-
if (au_name != NULL)
5589-
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
5590-
curbuf->b_fname, TRUE, curbuf);
5579+
if (au_name != NULL)
5580+
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
5581+
curbuf->b_fname, TRUE, curbuf);
55915582
#endif
5592-
if (eap->cmdidx == CMD_cexpr || eap->cmdidx == CMD_lexpr)
5593-
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
5594-
}
5583+
if (res > 0 && (eap->cmdidx == CMD_cexpr ||
5584+
eap->cmdidx == CMD_lexpr))
5585+
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
55955586
}
55965587
else
55975588
EMSG(_("E777: String or List expected"));

src/screen.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8070,8 +8070,11 @@ screen_start_highlight(int attr)
80708070
out_str(T_ME);
80718071
if ((attr & HL_STANDOUT) && T_SO != NULL) /* standout */
80728072
out_str(T_SO);
8073-
if ((attr & (HL_UNDERLINE | HL_UNDERCURL)) && T_US != NULL)
8074-
/* underline or undercurl */
8073+
if ((attr & HL_UNDERCURL) && T_UCS != NULL) /* undercurl */
8074+
out_str(T_UCS);
8075+
if (((attr & HL_UNDERLINE) /* underline or undercurl */
8076+
|| ((attr & HL_UNDERCURL) && T_UCS == NULL))
8077+
&& T_US != NULL)
80758078
out_str(T_US);
80768079
if ((attr & HL_ITALIC) && T_CZH != NULL) /* italic */
80778080
out_str(T_CZH);
@@ -8189,7 +8192,15 @@ screen_stop_highlight(void)
81898192
else
81908193
out_str(T_SE);
81918194
}
8192-
if (screen_attr & (HL_UNDERLINE | HL_UNDERCURL))
8195+
if ((screen_attr & HL_UNDERCURL) && T_UCE != NULL)
8196+
{
8197+
if (STRCMP(T_UCE, T_ME) == 0)
8198+
do_ME = TRUE;
8199+
else
8200+
out_str(T_UCE);
8201+
}
8202+
if ((screen_attr & HL_UNDERLINE)
8203+
|| ((screen_attr & HL_UNDERCURL) && T_UCE == NULL))
81938204
{
81948205
if (STRCMP(T_UE, T_ME) == 0)
81958206
do_ME = TRUE;

0 commit comments

Comments
 (0)