Skip to content

Commit b050192

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 8df28f3 + 91c5262 commit b050192

17 files changed

+154
-83
lines changed

src/gui.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ gui_init_check(void)
447447
* See gui_do_fork().
448448
* Use a simpler check if the GUI window can probably be opened.
449449
*/
450-
result = gui.dofork ? gui_mch_early_init_check() : gui_mch_init_check();
450+
result = gui.dofork ? gui_mch_early_init_check(TRUE) : gui_mch_init_check();
451451
# else
452452
result = gui_mch_init_check();
453453
# endif

src/gui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# include <X11/StringDefs.h>
1717
#endif
1818

19-
#ifdef FEAT_BEVAL
19+
#if defined(FEAT_BEVAL) || defined(PROTO)
2020
# include "gui_beval.h"
2121
#endif
2222

src/gui_gtk_x11.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,10 @@ gui_mch_prepare(int *argc, char **argv)
542542
}
543543

544544
/* These arguments make gnome_program_init() print a message and exit.
545-
* Must start the GUI for this, otherwise ":gui" will exit later! */
546-
if (option->flags & ARG_NEEDS_GUI)
545+
* Must start the GUI for this, otherwise ":gui" will exit later!
546+
* Only when the GUI can start. */
547+
if ((option->flags & ARG_NEEDS_GUI)
548+
&& gui_mch_early_init_check(FALSE) == OK)
547549
gui.starting = TRUE;
548550

549551
if (option->flags & ARG_KEEP)
@@ -1663,7 +1665,7 @@ selection_get_cb(GtkWidget *widget UNUSED,
16631665
* Return OK or FAIL.
16641666
*/
16651667
int
1666-
gui_mch_early_init_check(void)
1668+
gui_mch_early_init_check(int give_message)
16671669
{
16681670
char_u *p;
16691671

@@ -1672,7 +1674,8 @@ gui_mch_early_init_check(void)
16721674
if (p == NULL || *p == NUL)
16731675
{
16741676
gui.dying = TRUE;
1675-
EMSG(_((char *)e_opendisp));
1677+
if (give_message)
1678+
EMSG(_((char *)e_opendisp));
16761679
return FAIL;
16771680
}
16781681
return OK;

src/gui_w32.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ gui_mch_set_rendering_options(char_u *s)
247247
# define CONST
248248
# define FAR
249249
# define NEAR
250+
# undef _cdecl
250251
# define _cdecl
251252
typedef int BOOL;
252253
typedef int BYTE;
@@ -288,6 +289,7 @@ typedef void VOID;
288289
typedef int LPNMHDR;
289290
typedef int LONG;
290291
typedef int WNDPROC;
292+
typedef int UINT_PTR;
291293
#endif
292294

293295
#ifndef GET_X_LPARAM
@@ -3451,7 +3453,7 @@ gui_mch_settitle(
34513453
set_window_title(s_hwnd, (title == NULL ? "VIM" : (char *)title));
34523454
}
34533455

3454-
#ifdef FEAT_MOUSESHAPE
3456+
#if defined(FEAT_MOUSESHAPE) || defined(PROTO)
34553457
/* Table for shape IDCs. Keep in sync with the mshape_names[] table in
34563458
* misc2.c! */
34573459
static LPCSTR mshape_idcs[] =
@@ -3514,7 +3516,7 @@ mch_set_mouse_shape(int shape)
35143516
}
35153517
#endif
35163518

3517-
#ifdef FEAT_BROWSE
3519+
#if defined(FEAT_BROWSE) || defined(PROTO)
35183520
/*
35193521
* The file browser exists in two versions: with "W" uses wide characters,
35203522
* without "W" the current codepage. When FEAT_MBYTE is defined and on

src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ main
436436
#endif
437437
}
438438
#endif /* NO_VIM_MAIN */
439+
#endif /* PROTO */
439440

440441
/*
441442
* vim_main2() is needed for FEAT_MZSCHEME, but we define it always to keep
@@ -942,7 +943,6 @@ vim_main2(void)
942943

943944
return 0;
944945
}
945-
#endif /* PROTO */
946946

947947
/*
948948
* Initialisation shared by main() and some tests.

src/ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6283,7 +6283,7 @@ write_viminfo_registers(FILE *fp)
62836283
* 'permanent' of the two), otherwise the PRIMARY one.
62846284
* For now, use a hard-coded sanity limit of 1Mb of data.
62856285
*/
6286-
#if defined(FEAT_X11) && defined(FEAT_CLIPBOARD)
6286+
#if (defined(FEAT_X11) && defined(FEAT_CLIPBOARD)) || defined(PROTO)
62876287
void
62886288
x11_export_final_selection(void)
62896289
{

src/proto/fileio.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void free_all_autocmds(void);
3333
int check_ei(void);
3434
char_u *au_event_disable(char *what);
3535
void au_event_restore(char_u *old_ei);
36-
void do_autocmd(char_u *arg, int forceit);
36+
void do_autocmd(char_u *arg_in, int forceit);
3737
int do_doautocmd(char_u *arg, int do_msg, int *did_something);
3838
void ex_doautoall(exarg_T *eap);
3939
int check_nomodeline(char_u **argp);

src/proto/gui_gtk_x11.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ int gui_mch_is_blink_off(void);
66
void gui_mch_set_blinking(long waittime, long on, long off);
77
void gui_mch_stop_blink(void);
88
void gui_mch_start_blink(void);
9-
int gui_mch_early_init_check(void);
9+
int gui_mch_early_init_check(int give_message);
1010
int gui_mch_init_check(void);
1111
void gui_mch_show_tabline(int showit);
1212
int gui_mch_showing_tabline(void);

src/proto/main.pro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* main.c */
2-
void common_init(mparm_T *params);
2+
int vim_main2(void);
3+
void common_init(mparm_T *paramp);
34
void main_loop(int cmdwin, int noexmode);
45
void getout_preserve_modified(int exitval);
56
void getout(int exitval);

src/proto/message.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ int verb_msg(char_u *s);
44
int msg_attr(char_u *s, int attr);
55
int msg_attr_keep(char_u *s, int attr, int keep);
66
char_u *msg_strtrunc(char_u *s, int force);
7-
void trunc_string(char_u *s, char_u *buf, int room, int buflen);
7+
void trunc_string(char_u *s, char_u *buf, int room_in, int buflen);
88
void reset_last_sourcing(void);
99
void msg_source(int attr);
1010
int emsg_not_now(void);

src/proto/normal.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void push_showcmd(void);
1616
void pop_showcmd(void);
1717
void do_check_scrollbind(int check);
1818
void check_scrollbind(linenr_T topline_diff, long leftcol_diff);
19-
int find_decl(char_u *ptr, int len, int locally, int thisblock, int searchflags);
19+
int find_decl(char_u *ptr, int len, int locally, int thisblock, int flags_arg);
2020
void scroll_redraw(int up, long count);
2121
void handle_tabmenu(void);
2222
void do_nv_ident(int c1, int c2);

src/proto/ops.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void op_addsub(oparg_T *oap, linenr_T Prenum1, int g_cmd);
4747
void prepare_viminfo_registers(void);
4848
void finish_viminfo_registers(void);
4949
int read_viminfo_register(vir_T *virp, int force);
50-
void handle_viminfo_register(garray_T *values, int writing);
50+
void handle_viminfo_register(garray_T *values, int force);
5151
void write_viminfo_registers(FILE *fp);
5252
void x11_export_final_selection(void);
5353
void clip_free_selection(VimClipboard *cbd);

src/testdir/test_glob2regpat.vim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ func Test_valid()
1616
call assert_equal('^\(foo\|bar\)$', glob2regpat('{foo,bar}'))
1717
call assert_equal('.*', glob2regpat('**'))
1818

19-
if has('unix')
19+
if exists('+shellslash')
20+
call assert_equal('^foo[\/].$', glob2regpat('foo\?'))
21+
call assert_equal('^\(foo[\/]\|bar\|foobar\)$', glob2regpat('{foo\,bar,foobar}'))
22+
call assert_equal('^[\/]\(foo\|bar[\/]\)$', glob2regpat('\{foo,bar\}'))
23+
call assert_equal('^[\/][\/]\(foo\|bar[\/][\/]\)$', glob2regpat('\\{foo,bar\\}'))
24+
else
2025
call assert_equal('^foo?$', glob2regpat('foo\?'))
2126
call assert_equal('^\(foo,bar\|foobar\)$', glob2regpat('{foo\,bar,foobar}'))
2227
call assert_equal('^{foo,bar}$', glob2regpat('\{foo,bar\}'))
2328
call assert_equal('^\\\(foo\|bar\\\)$', glob2regpat('\\{foo,bar\\}'))
24-
" todo: Windows
2529
endif
2630
endfunc

src/testdir/test_signs.vim

Lines changed: 92 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,71 @@ func Test_sign()
88
new
99
call setline(1, ['a', 'b', 'c', 'd'])
1010

11+
" Define some signs.
12+
" We can specify icons even if not all versions of vim support icons as
13+
" icon is ignored when not supported. "(not supported)" is shown after
14+
" the icon name when listing signs.
1115
sign define Sign1 text=x
12-
sign define Sign2 text=y
16+
try
17+
sign define Sign2 text=xy texthl=Title linehl=Error icon=../../pixmaps/stock_vim_find_help.png
18+
catch /E255:/
19+
" ignore error: E255: Couldn't read in sign data!
20+
" This error can happen when running in gui.
21+
" Some gui like Motif do not support the png icon format.
22+
endtry
1323

1424
" Test listing signs.
1525
let a=execute('sign list')
16-
call assert_equal("\nsign Sign1 text=x \nsign Sign2 text=y ", a)
26+
call assert_match("^\nsign Sign1 text=x \nsign Sign2 icon=../../pixmaps/stock_vim_find_help.png .*text=xy linehl=Error texthl=Title$", a)
1727

1828
let a=execute('sign list Sign1')
1929
call assert_equal("\nsign Sign1 text=x ", a)
2030

21-
" Place the sign at line 3,then check that we can jump to it.
22-
exe 'sign place 42 line=3 name=Sign1 buffer=' . bufnr('')
31+
" Split the window to the bottom to verify sign jump will stay in the current window
32+
" if the buffer is displayed there.
33+
let bn = bufnr('%')
34+
let wn = winnr()
35+
exe 'sign place 41 line=3 name=Sign1 buffer=' . bn
36+
1
37+
bot split
38+
exe 'sign jump 41 buffer=' . bufnr('%')
39+
call assert_equal('c', getline('.'))
40+
call assert_equal(3, winnr())
41+
call assert_equal(bn, bufnr('%'))
42+
call assert_notequal(wn, winnr())
43+
44+
" Create a new buffer and check that ":sign jump" switches to the old buffer.
2345
1
24-
exe 'sign jump 42 buffer=' . bufnr('')
46+
new foo
47+
call assert_notequal(bn, bufnr('%'))
48+
exe 'sign jump 41 buffer=' . bn
49+
call assert_equal(bn, bufnr('%'))
2550
call assert_equal('c', getline('.'))
2651

27-
" Can't change sign.
28-
call assert_fails("exe 'sign place 43 name=Sign1 buffer=' . bufnr('')", 'E885:')
52+
" Redraw to make sure that screen redraw with sign gets exercised,
53+
" with and without 'rightleft'.
54+
if has('rightleft')
55+
set rightleft
56+
redraw
57+
set norightleft
58+
endif
59+
redraw
2960

61+
" Check that we can't change sign.
62+
call assert_fails("exe 'sign place 40 name=Sign1 buffer=' . bufnr('%')", 'E885:')
63+
64+
" Check placed signs
3065
let a=execute('sign place')
31-
call assert_equal("\n--- Signs ---\nSigns for [NULL]:\n line=3 id=42 name=Sign1\n", a)
66+
call assert_equal("\n--- Signs ---\nSigns for [NULL]:\n line=3 id=41 name=Sign1\n", a)
3267

33-
" Unplace the sign and try jumping to it again should now fail.
34-
sign unplace 42
68+
" Unplace the sign and try jumping to it again should fail.
69+
sign unplace 41
3570
1
36-
call assert_fails("exe 'sign jump 42 buffer=' . bufnr('')", 'E157:')
71+
call assert_fails("exe 'sign jump 41 buffer=' . bufnr('%')", 'E157:')
3772
call assert_equal('a', getline('.'))
3873

3974
" Unplace sign on current line.
40-
exe 'sign place 43 line=4 name=Sign2 buffer=' . bufnr('')
75+
exe 'sign place 42 line=4 name=Sign2 buffer=' . bufnr('%')
4176
4
4277
sign unplace
4378
let a=execute('sign place')
@@ -47,16 +82,54 @@ func Test_sign()
4782
call assert_fails('sign unplace', 'E159:')
4883

4984
" Unplace all signs.
50-
exe 'sign place 42 line=3 name=Sign1 buffer=' . bufnr('')
85+
exe 'sign place 41 line=3 name=Sign1 buffer=' . bufnr('%')
5186
sign unplace *
5287
let a=execute('sign place')
5388
call assert_equal("\n--- Signs ---\n", a)
5489

90+
" Check :jump with file=...
91+
edit foo
92+
call setline(1, ['A', 'B', 'C', 'D'])
93+
94+
try
95+
sign define Sign3 text=y texthl=DoesNotExist linehl=DoesNotExist icon=doesnotexist.xpm
96+
catch /E255:/
97+
" ignore error: E255: it can happens for guis.
98+
endtry
99+
100+
let fn = expand('%:p')
101+
exe 'sign place 43 line=2 name=Sign3 file=' . fn
102+
edit bar
103+
call assert_notequal(fn, expand('%:p'))
104+
exe 'sign jump 43 file=' . fn
105+
call assert_equal('B', getline('.'))
106+
55107
" After undefining the sign, we should no longer be able to place it.
56108
sign undefine Sign1
57109
sign undefine Sign2
58-
call assert_fails("exe 'sign place 42 line=3 name=Sign1 buffer=' . bufnr('')", 'E155:')
110+
sign undefine Sign3
111+
call assert_fails("exe 'sign place 41 line=3 name=Sign1 buffer=' . bufnr('%')", 'E155:')
112+
endfunc
113+
114+
" Undefining placed sign is not recommended.
115+
" Quoting :help sign
116+
"
117+
" :sign undefine {name}
118+
" Deletes a previously defined sign. If signs with this {name}
119+
" are still placed this will cause trouble.
120+
func Test_sign_undefine_still_placed()
121+
new foobar
122+
sign define Sign text=x
123+
exe 'sign place 41 line=1 name=Sign buffer=' . bufnr('%')
124+
sign undefine Sign
125+
126+
" Listing placed sign should show that sign is deleted.
127+
let a=execute('sign place')
128+
call assert_equal("\n--- Signs ---\nSigns for foobar:\n line=1 id=41 name=[Deleted]\n", a)
59129

130+
sign unplace 41
131+
let a=execute('sign place')
132+
call assert_equal("\n--- Signs ---\n", a)
60133
endfunc
61134

62135
func Test_sign_completion()
@@ -72,6 +145,9 @@ func Test_sign_completion()
72145
call feedkeys(":sign define Sign linehl=Spell\<C-A>\<C-B>\"\<CR>", 'tx')
73146
call assert_equal('"sign define Sign linehl=SpellBad SpellCap SpellLocal SpellRare', @:)
74147

148+
call feedkeys(":sign define Sign icon=../../pixmaps/tb_p\<C-A>\<C-B>\"\<CR>", 'tx')
149+
call assert_equal('"sign define Sign icon=../../pixmaps/tb_paste.xpm ../../pixmaps/tb_print.xpm', @:)
150+
75151
call feedkeys(":sign undefine \<C-A>\<C-B>\"\<CR>", 'tx')
76152
call assert_equal('"sign undefine Sign1 Sign2', @:)
77153

@@ -92,13 +168,14 @@ func Test_sign_completion()
92168

93169
sign undefine Sign1
94170
sign undefine Sign2
95-
96171
endfunc
97172

98173
func Test_sign_invalid_commands()
99174
call assert_fails('sign', 'E471:')
175+
call assert_fails('sign jump', 'E471:')
100176
call assert_fails('sign xxx', 'E160:')
101177
call assert_fails('sign define', 'E156:')
178+
call assert_fails('sign define Sign1 xxx', 'E475:')
102179
call assert_fails('sign undefine', 'E156:')
103180
call assert_fails('sign list xxx', 'E155:')
104181
call assert_fails('sign place 1 buffer=', 'E158:')

src/version.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,18 @@ static char *(features[]) =
778778

779779
static int included_patches[] =
780780
{ /* Add new patch number below this line */
781+
/**/
782+
2196,
783+
/**/
784+
2195,
785+
/**/
786+
2194,
787+
/**/
788+
2193,
789+
/**/
790+
2192,
791+
/**/
792+
2191,
781793
/**/
782794
2190,
783795
/**/

src/vim.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2112,7 +2112,7 @@ typedef enum
21122112
* been seen at that stage. But it must be before globals.h, where error_ga
21132113
* is declared. */
21142114
#if !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_X11) \
2115-
&& !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC)
2115+
&& !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MAC) && !defined(PROTO)
21162116
# define mch_errmsg(str) fprintf(stderr, "%s", (str))
21172117
# define display_errors() fflush(stderr)
21182118
# define mch_msg(str) printf("%s", (str))
@@ -2443,9 +2443,6 @@ typedef enum
24432443
#define JSON_JS 1 /* use JS instead of JSON */
24442444
#define JSON_NO_NONE 2 /* v:none item not allowed */
24452445

2446-
/* This is in main.c, cproto can't handle it. */
2447-
int vim_main2(void);
2448-
24492446
/* Used for flags of do_in_path() */
24502447
#define DIP_ALL 0x01 /* all matches, not just the first one */
24512448
#define DIP_DIR 0x02 /* find directories instead of files. */

0 commit comments

Comments
 (0)