• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisionc773cb978acfd216004c871e883d2b31cd4cc0bf (tree)
Zeit2005-07-26 05:46:57
Autorvimboss
Commitervimboss

Log Message

updated for version 7.0116

Ändern Zusammenfassung

Diff

diff -r d0d15b184c56 -r c773cb978acf runtime/doc/quickfix.txt
--- a/runtime/doc/quickfix.txt Mon Jul 25 20:42:36 2005 +0000
+++ b/runtime/doc/quickfix.txt Mon Jul 25 20:46:57 2005 +0000
@@ -1,4 +1,4 @@
1-*quickfix.txt* For Vim version 7.0aa. Last change: 2005 May 20
1+*quickfix.txt* For Vim version 7.0aa. Last change: 2005 Jul 25
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -334,6 +334,8 @@
334334 Examples: >
335335 :vimgrep /an error/ *.c
336336 :vimgrep /\<FileName\>/ *.h include/*
337+ :vimgrep /myfunc/ **/*.c
338+< For the use of "**" see |starstar-wildcard|.
337339
338340 :vim[grep][!] {pattern} {file} ...
339341 Like above, but instead of enclosing the pattern in a
diff -r d0d15b184c56 -r c773cb978acf runtime/doc/todo.txt
--- a/runtime/doc/todo.txt Mon Jul 25 20:42:36 2005 +0000
+++ b/runtime/doc/todo.txt Mon Jul 25 20:46:57 2005 +0000
@@ -1,4 +1,4 @@
1-*todo.txt* For Vim version 7.0aa. Last change: 2005 Jul 24
1+*todo.txt* For Vim version 7.0aa. Last change: 2005 Jul 25
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -52,18 +52,12 @@
5252 - Win32: tearoff menu window should have a scrollbar when it's taller than
5353 the screen.
5454 - mblen(NULL, 0) also in Vim 6.3?
55-
56-Win32: Crash when pasting Simplified Chinese in utf-8. (rainux, 2005 June 20)
55+- Win32: Crash when pasting Simplified Chinese in utf-8. (rainux, 2005 June
56+ 20)
5757
5858
5959 PLANNED FOR VERSION 7.0:
6060
61-- REFACTORING:
62- Improve the interface between the generic GUI code and the system-specific
63- code. Generic code handles text window with scrollbars, system-specific
64- code menu, toolbar, etc.
65-- Support using "**" in filename for ":next", ":vimgrep", etc., so that a
66- directory tree can be searched.
6761 - Store messages to allow SCROLLING BACK for all commands. And other "less"
6862 like commands.
6963 - "INTELLISENSE". First cleanup the Insert-mode completion.
@@ -313,6 +307,7 @@
313307 (2003 May 13)
314308 raisewin() raise gvim window (see HierAssist patch for
315309 Tcl implementation ~/vim/HierAssist/ )
310+ 7 Make globpath() also work with upwards search. (Brian Medley)
316311 7 Add patch from Benoit Cerrina to integrate Vim and Perl functions
317312 better. Now also works for Ruby (2001 Nov 10)
318313 - Patch from Herculano de Lima Einloft Neto for better formatting of the
@@ -1573,7 +1568,6 @@
15731568 Alternative: Support packages. {package-name}:{function-name}().
15741569 Packages are loaded automatically when first used, from
15751570 $VIMRUNTIME/packages (or use a search path).
1576-7 Make globpath() also work with "**" and upwards search. (Brian Medley)
15771571 7 Add the markclear() function to delete a mark in another buffer. Charles
15781572 Campbell (2004 Jan 9)
15791573 http://mysite.verizon.net/astronaut/vim/index.html#Patch
@@ -3156,7 +3150,6 @@
31563150 9 Support ACLs on more systems.
31573151 7 Add ModeMsgVisual, ModeMsgInsert, etc. so that each mode message can be
31583152 highlighted differently.
3159-8 Allow using "**" as a wildcard in commands like ":next" and ":args".
31603153 7 Add a message area for the user. Set some option to reserve space (above
31613154 the command line?). Use an ":echouser" command to display the message
31623155 (truncated to fit in the space).
diff -r d0d15b184c56 -r c773cb978acf runtime/doc/version7.txt
--- a/runtime/doc/version7.txt Mon Jul 25 20:42:36 2005 +0000
+++ b/runtime/doc/version7.txt Mon Jul 25 20:46:57 2005 +0000
@@ -1,4 +1,4 @@
1-*version7.txt* For Vim version 7.0aa. Last change: 2005 Jul 21
1+*version7.txt* For Vim version 7.0aa. Last change: 2005 Jul 25
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -222,6 +222,10 @@
222222 If you want to use the search results in a script you can use the
223223 |getqflist()| function.
224224
225+To search in files in various directories the "**" pattern can be used. It
226+expands into an arbitrary depth of directories. "**" can be used in all
227+places where file names are expanded, thus also with |:next| and |:args|.
228+
225229
226230 POSIX compatibility *new-posix*
227231 -------------------
@@ -614,7 +618,7 @@
614618 ":redir => variable" and ":redir =>> variable" write or append to a variable.
615619 (Yegappan Lakshmanan) |:redir|
616620
617-":redir @{a-z}>>" appends to register a to z.
621+":redir @{a-z}>>" appends to register a to z. (Yegappan Lakshmanan)
618622
619623 The 'verbosefile' option can be used to log messages in a file. Verbose
620624 messages are not displayed then. The "-V{filename}" argument can be used to
@@ -693,11 +697,15 @@
693697
694698 Added the "customlist" completion argument to a user-defined command. The
695699 user-defined completion function should return the completion candidates as a
696-Vim List and the returned results are not filtered by Vim.
700+Vim List and the returned results are not filtered by Vim. (Yegappan
701+Lakshmanan)
697702
698703 Win32: Balloons can have multiple lines if common controls supports it.
699704 (Sergey Khorev)
700705
706+The 's' flag is added to the search() and searchpair() function to set the
707+' mark if the cursor is moved. (Yegappan Lakshmanan)
708+
701709 ==============================================================================
702710 COMPILE TIME CHANGES *compile-changes-7*
703711
@@ -720,6 +728,15 @@
720728 allocated by X11 library functions and the memory allocated in alloc_cmdbuff()
721729 to store the ":quit" command.
722730
731+Moved the code for printing to src/hardcopy.c.
732+
733+Moved some code from main() to separate functions to make it easier to see
734+what is being done. Use a structure to avoid a lot of arguments to the
735+functions.
736+
737+Moved unix_expandpath() to misc1.c, so that it can also be used by os_mac.c
738+without copying the code.
739+
723740 ==============================================================================
724741 BUG FIXES *bug-fixes-7*
725742
diff -r d0d15b184c56 -r c773cb978acf src/eval.c
--- a/src/eval.c Mon Jul 25 20:42:36 2005 +0000
+++ b/src/eval.c Mon Jul 25 20:46:57 2005 +0000
@@ -12724,6 +12724,7 @@
1272412724 #define SP_NOMOVE 1 /* don't move cursor */
1272512725 #define SP_REPEAT 2 /* repeat to find outer pair */
1272612726 #define SP_RETCOUNT 4 /* return matchcount */
12727+#define SP_SETPCMARK 8 /* set previous context mark */
1272712728
1272812729 static int get_search_arg __ARGS((typval_T *varp, int *flagsp));
1272912730
@@ -12761,6 +12762,7 @@
1276112762 case 'n': mask = SP_NOMOVE; break;
1276212763 case 'r': mask = SP_REPEAT; break;
1276312764 case 'm': mask = SP_RETCOUNT; break;
12765+ case 's': mask = SP_SETPCMARK; break;
1276412766 }
1276512767 if (mask == 0)
1276612768 {
@@ -12799,7 +12801,14 @@
1279912801 dir = get_search_arg(&argvars[1], &flags); /* may set p_ws */
1280012802 if (dir == 0)
1280112803 goto theend;
12802- if ((flags & ~SP_NOMOVE) != 0)
12804+ /*
12805+ * This function accepts only SP_NOMOVE and SP_SETPCMARK flags.
12806+ * Check to make sure only those flags are set.
12807+ * Also, Only the SP_NOMOVE or the SP_SETPCMARK flag can be set. Both
12808+ * flags cannot be set. Check for that condition also.
12809+ */
12810+ if (((flags & ~(SP_NOMOVE | SP_SETPCMARK)) != 0) ||
12811+ ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK)))
1280312812 {
1280412813 EMSG2(_(e_invarg2), get_tv_string(&argvars[1]));
1280512814 goto theend;
@@ -12810,6 +12819,8 @@
1281012819 SEARCH_KEEP, RE_SEARCH) != FAIL)
1281112820 {
1281212821 rettv->vval.v_number = pos.lnum;
12822+ if (flags & SP_SETPCMARK)
12823+ setpcmark();
1281312824 curwin->w_cursor = pos;
1281412825 /* "/$" will put the cursor after the end of the line, may need to
1281512826 * correct that here */
@@ -12853,6 +12864,14 @@
1285312864 dir = get_search_arg(&argvars[3], &flags); /* may set p_ws */
1285412865 if (dir == 0)
1285512866 goto theend;
12867+ /*
12868+ * Only one of the SP_NOMOVE or SP_SETPCMARK flags can be set.
12869+ */
12870+ if ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))
12871+ {
12872+ EMSG2(_(e_invarg2), get_tv_string(&argvars[1]));
12873+ goto theend;
12874+ }
1285612875
1285712876 /* Optional fifth argument: skip expresion */
1285812877 if (argvars[3].v_type == VAR_UNKNOWN
@@ -12980,6 +12999,8 @@
1298012999 ++retval;
1298113000 else
1298213001 retval = pos.lnum;
13002+ if (flags & SP_SETPCMARK)
13003+ setpcmark();
1298313004 curwin->w_cursor = pos;
1298413005 if (!(flags & SP_REPEAT))
1298513006 break;
diff -r d0d15b184c56 -r c773cb978acf src/ex_cmds.c
--- a/src/ex_cmds.c Mon Jul 25 20:42:36 2005 +0000
+++ b/src/ex_cmds.c Mon Jul 25 20:46:57 2005 +0000
@@ -5369,13 +5369,15 @@
53695369 char_u *s, *d;
53705370 int i;
53715371 static char *(mtable[]) = {"*", "g*", "[*", "]*", ":*",
5372- "/*", "/\\*", "\"*", "/\\(\\)",
5372+ "/*", "/\\*", "\"*", "**",
5373+ "/\\(\\)",
53735374 "?", ":?", "?<CR>", "g?", "g?g?", "g??", "z?",
53745375 "/\\?", "/\\z(\\)", "\\=", ":s\\=",
53755376 "[count]", "[quotex]", "[range]",
53765377 "[pattern]", "\\|", "\\%$"};
53775378 static char *(rtable[]) = {"star", "gstar", "[star", "]star", ":star",
5378- "/star", "/\\\\star", "quotestar", "/\\\\(\\\\)",
5379+ "/star", "/\\\\star", "quotestar", "starstar",
5380+ "/\\\\(\\\\)",
53795381 "?", ":?", "?<CR>", "g?", "g?g?", "g??", "z?",
53805382 "/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
53815383 "\\[count]", "\\[quotex]", "\\[range]",
diff -r d0d15b184c56 -r c773cb978acf src/gui_gtk_x11.c
--- a/src/gui_gtk_x11.c Mon Jul 25 20:42:36 2005 +0000
+++ b/src/gui_gtk_x11.c Mon Jul 25 20:46:57 2005 +0000
@@ -4066,8 +4066,11 @@
40664066 }
40674067 #endif /* HAVE_GTK2 */
40684068
4069+/*
4070+ * Adjust gui.char_height (after 'linespace' was changed).
4071+ */
40694072 int
4070-gui_mch_adjust_charsize(void)
4073+gui_mch_adjust_charheight(void)
40714074 {
40724075 #ifdef HAVE_GTK2
40734076 PangoFontMetrics *metrics;
@@ -4082,14 +4085,14 @@
40824085 pango_font_metrics_unref(metrics);
40834086
40844087 gui.char_height = (ascent + descent + PANGO_SCALE - 1) / PANGO_SCALE
4085- + p_linespace;
4088+ + p_linespace;
40864089 /* LINTED: avoid warning: bitwise operation on signed value */
40874090 gui.char_ascent = PANGO_PIXELS(ascent + p_linespace * PANGO_SCALE / 2);
40884091
40894092 #else /* !HAVE_GTK2 */
40904093
40914094 gui.char_height = gui.current_font->ascent + gui.current_font->descent
4092- + p_linespace;
4095+ + p_linespace;
40934096 gui.char_ascent = gui.current_font->ascent + p_linespace / 2;
40944097
40954098 #endif /* !HAVE_GTK2 */
@@ -4553,7 +4556,7 @@
45534556 if (gui.char_width <= 0)
45544557 gui.char_width = 8;
45554558
4556- gui_mch_adjust_charsize();
4559+ gui_mch_adjust_charheight();
45574560
45584561 /* Set the fontname, which will be used for information purposes */
45594562 hl_set_font_name(font_name);
diff -r d0d15b184c56 -r c773cb978acf src/gui_x11.c
--- a/src/gui_x11.c Mon Jul 25 20:42:36 2005 +0000
+++ b/src/gui_x11.c Mon Jul 25 20:46:57 2005 +0000
@@ -632,15 +632,14 @@
632632 #if (defined(FEAT_NETBEANS_INTG) || defined(FEAT_SUN_WORKSHOP)) \
633633 || defined(PROTO)
634634 /*
635- * This function fills in the XRectangle object with the current
636- * x,y coordinates and height, width so that an XtVaSetValues to
637- * the same shell of those resources will restore the window to its
638- * formar position and dimensions.
635+ * This function fills in the XRectangle object with the current x,y
636+ * coordinates and height, width so that an XtVaSetValues to the same shell of
637+ * those resources will restore the window to its formar position and
638+ * dimensions.
639639 *
640- * Note: This function may fail, in which case the XRectangle will
641- * be unchanged. Be sure to have the XRectangle set with the
642- * proper values for a failed condition prior to calling this
643- * function.
640+ * Note: This function may fail, in which case the XRectangle will be
641+ * unchanged. Be sure to have the XRectangle set with the proper values for a
642+ * failed condition prior to calling this function.
644643 */
645644 static void
646645 shellRectangle(Widget shell, XRectangle *r)
@@ -1807,7 +1806,7 @@
18071806 }
18081807
18091808 /*
1810- * Allow 10 pixels for horizontal borders, 30 for vertical borders.
1809+ * Allow 10 pixels for horizontal borders, 'guiheadroom' for vertical borders.
18111810 * Is there no way in X to find out how wide the borders really are?
18121811 */
18131812 void
@@ -2019,8 +2018,11 @@
20192018 }
20202019 #endif
20212020
2021+/*
2022+ * Adjust gui.char_height (after 'linespace' was changed).
2023+ */
20222024 int
2023-gui_mch_adjust_charsize()
2025+gui_mch_adjust_charheight()
20242026 {
20252027 #ifdef FEAT_XFONTSET
20262028 if (gui.fontset != NOFONTSET)
@@ -2076,24 +2078,6 @@
20762078 }
20772079 #endif
20782080
2079-#if 0 /* not used */
2080-/*
2081- * Return TRUE if the two fonts given are equivalent.
2082- */
2083- int
2084-gui_mch_same_font(f1, f2)
2085- GuiFont f1;
2086- GuiFont f2;
2087-{
2088-#ifdef FEAT_XFONTSET
2089- if (gui.fontset != NULL)
2090- return f1 == f2;
2091- else
2092-#endif
2093- return ((XFontStruct *)f1)->fid == ((XFontStruct *)f2)->fid;
2094-}
2095-#endif
2096-
20972081 /*
20982082 * If a font is not going to be used, free its structure.
20992083 */
diff -r d0d15b184c56 -r c773cb978acf src/main.c
--- a/src/main.c Mon Jul 25 20:42:36 2005 +0000
+++ b/src/main.c Mon Jul 25 20:46:57 2005 +0000
@@ -39,7 +39,6 @@
3939 char **argv;
4040
4141 int evim_mode; /* started as "evim" */
42- int bin_mode; /* -b argument used */
4342 char_u *use_vimrc; /* vimrc from -u argument */
4443
4544 int n_commands; /* no. of commands from + or -c */
@@ -367,15 +366,6 @@
367366 # endif
368367 #endif
369368
370- /* "-b" argument used. Check before expanding file names, because for
371- * Win32 this makes us edit a shortcut file itself, instead of the file it
372- * links to. */
373- if (params.bin_mode)
374- {
375- set_options_bin(curbuf->b_p_bin, 1, 0);
376- curbuf->b_p_bin = 1; /* binary file I/O */
377- }
378-
379369 if (GARGCOUNT > 0)
380370 {
381371 #if (!defined(UNIX) && !defined(__EMX__)) || defined(ARCHIE)
@@ -420,8 +410,13 @@
420410 TIME_MSG("expanding arguments");
421411
422412 #ifdef FEAT_DIFF
423- if (params.diff_mode && params.window_count == -1)
424- params.window_count = 0; /* open up to 3 files in a window */
413+ if (params.diff_mode)
414+ {
415+ if (params.window_count == -1)
416+ params.window_count = 0; /* open up to 3 windows */
417+ if (params.vert_windows == MAYBE)
418+ params.vert_windows = TRUE; /* use vertical split */
419+ }
425420 #endif
426421
427422 /* Don't redraw until much later. */
@@ -1453,7 +1448,7 @@
14531448 int had_minmin = FALSE; /* found "--" argument */
14541449 int want_argument; /* option argument with argument */
14551450 int c;
1456- char_u *p;
1451+ char_u *p = NULL;
14571452 long n;
14581453
14591454 --argc;
@@ -1597,7 +1592,11 @@
15971592 break;
15981593
15991594 case 'b': /* "-b" binary mode */
1600- parmp->bin_mode = TRUE; /* postpone to after reading .exrc files */
1595+ /* Needs to be effective before expanding file names, because
1596+ * for Win32 this makes us edit a shortcut file itself,
1597+ * instead of the file it links to. */
1598+ set_options_bin(curbuf->b_p_bin, 1, 0);
1599+ curbuf->b_p_bin = 1; /* binary file I/O */
16011600 break;
16021601
16031602 case 'C': /* "-C" Compatible */
@@ -1691,7 +1690,8 @@
16911690 case 'o': /* "-o[N]" open N horizontal split windows */
16921691 #ifdef FEAT_WINDOWS
16931692 /* default is 0: open window for each file */
1694- parmp->window_count = get_number_arg((char_u *)argv[0], &argv_idx, 0);
1693+ parmp->window_count = get_number_arg((char_u *)argv[0],
1694+ &argv_idx, 0);
16951695 parmp->vert_windows = FALSE;
16961696 #endif
16971697 break;
@@ -1699,7 +1699,8 @@
16991699 case 'O': /* "-O[N]" open N vertical split windows */
17001700 #if defined(FEAT_VERTSPLIT) && defined(FEAT_WINDOWS)
17011701 /* default is 0: open window for each file */
1702- parmp->window_count = get_number_arg((char_u *)argv[0], &argv_idx, 0);
1702+ parmp->window_count = get_number_arg((char_u *)argv[0],
1703+ &argv_idx, 0);
17031704 parmp->vert_windows = TRUE;
17041705 #endif
17051706 break;
@@ -1817,7 +1818,8 @@
18171818 {
18181819 if (parmp->n_commands >= MAX_ARG_CMDS)
18191820 mainerr(ME_EXTRA_CMD, NULL);
1820- parmp->commands[parmp->n_commands++] = (char_u *)argv[0] + argv_idx;
1821+ parmp->commands[parmp->n_commands++] = (char_u *)argv[0]
1822+ + argv_idx;
18211823 argv_idx = -1;
18221824 break;
18231825 }
@@ -1890,13 +1892,15 @@
18901892 parmp->commands[parmp->n_commands++] = p;
18911893 }
18921894 else
1893- parmp->commands[parmp->n_commands++] = (char_u *)argv[0];
1895+ parmp->commands[parmp->n_commands++] =
1896+ (char_u *)argv[0];
18941897 break;
18951898
18961899 case '-': /* "--cmd {command}" execute command */
18971900 if (parmp->n_pre_commands >= MAX_ARG_CMDS)
18981901 mainerr(ME_EXTRA_CMD, NULL);
1899- parmp->pre_commands[parmp->n_pre_commands++] = (char_u *)argv[0];
1902+ parmp->pre_commands[parmp->n_pre_commands++] =
1903+ (char_u *)argv[0];
19001904 break;
19011905
19021906 /* case 'd': -d {device} is handled in mch_check_win() for the
@@ -2052,7 +2056,7 @@
20522056 #endif
20532057 alist_add(&global_alist, p,
20542058 #if (!defined(UNIX) && !defined(__EMX__)) || defined(ARCHIE)
2055- parmp->literal ? 2 : 0 /* add buffer number after expanding */
2059+ parmp->literal ? 2 : 0 /* add buffer nr after exp. */
20562060 #else
20572061 2 /* add buffer number now and use curbuf */
20582062 #endif
@@ -2425,7 +2429,8 @@
24252429 */
24262430 if (parmp->use_vimrc != NULL)
24272431 {
2428- if (STRCMP(parmp->use_vimrc, "NONE") == 0 || STRCMP(parmp->use_vimrc, "NORC") == 0)
2432+ if (STRCMP(parmp->use_vimrc, "NONE") == 0
2433+ || STRCMP(parmp->use_vimrc, "NORC") == 0)
24292434 {
24302435 #ifdef FEAT_GUI
24312436 if (use_gvimrc == NULL) /* don't load gvimrc either */
diff -r d0d15b184c56 -r c773cb978acf src/misc1.c
--- a/src/misc1.c Mon Jul 25 20:42:36 2005 +0000
+++ b/src/misc1.c Mon Jul 25 20:46:57 2005 +0000
@@ -8158,24 +8158,33 @@
81588158 # endif
81598159
81608160 /*
8161- * Recursively build up a list of files in "gap" matching the first wildcard
8162- * in `path'. Called by expand_wildcards().
8161+ * Recursively expand one path component into all matching files and/or
8162+ * directories. Adds matches to "gap". Handles "*", "?", "[a-z]", "**", etc.
81638163 * Return the number of matches found.
81648164 * "path" has backslashes before chars that are not to be expanded, starting
81658165 * at "path[wildoff]".
8166+ * Return the number of matches found.
8167+ * NOTE: much of this is identical to unix_expandpath(), keep in sync!
81668168 */
81678169 static int
81688170 dos_expandpath(
81698171 garray_T *gap,
81708172 char_u *path,
81718173 int wildoff,
8172- int flags) /* EW_* flags */
8173-{
8174- char_u *buf;
8175- char_u *path_end;
8176- char_u *p, *s, *e;
8177- int start_len = gap->ga_len;
8178- int ok;
8174+ int flags, /* EW_* flags */
8175+ int didstar) /* expaneded "**" once already */
8176+{
8177+ char_u *buf;
8178+ char_u *path_end;
8179+ char_u *p, *s, *e;
8180+ int start_len = gap->ga_len;
8181+ char_u *pat;
8182+ regmatch_T regmatch;
8183+ int starts_with_dot;
8184+ int matches;
8185+ int len;
8186+ int starstar = FALSE;
8187+ static int stardepth = 0; /* depth for "**" expansion */
81798188 #ifdef WIN3264
81808189 WIN32_FIND_DATA fb;
81818190 HANDLE hFind = (HANDLE)0;
@@ -8186,15 +8195,19 @@
81868195 #else
81878196 struct ffblk fb;
81888197 #endif
8189- int matches;
8190- int starts_with_dot;
8191- int len;
8192- char_u *pat;
8193- regmatch_T regmatch;
81948198 char_u *matchname;
8199+ int ok;
8200+
8201+ /* Expanding "**" may take a long time, check for CTRL-C. */
8202+ if (stardepth > 0)
8203+ {
8204+ ui_breakcheck();
8205+ if (got_int)
8206+ return 0;
8207+ }
81958208
81968209 /* make room for file name */
8197- buf = alloc((unsigned int)STRLEN(path) + BASENAMELEN + 5);
8210+ buf = alloc((int)STRLEN(path) + BASENAMELEN + 5);
81988211 if (buf == NULL)
81998212 return 0;
82008213
@@ -8247,6 +8260,11 @@
82478260 --s;
82488261 }
82498262
8263+ /* Check for "**" between "s" and "e". */
8264+ for (p = s; p < e; ++p)
8265+ if (p[0] == '*' && p[1] == '*')
8266+ starstar = TRUE;
8267+
82508268 starts_with_dot = (*s == '.');
82518269 pat = file_pat_to_reg_pat(s, e, NULL, FALSE);
82528270 if (pat == NULL)
@@ -8269,6 +8287,17 @@
82698287 /* remember the pattern or file name being looked for */
82708288 matchname = vim_strsave(s);
82718289
8290+ /* If "**" is by itself, this is the first time we encounter it and more
8291+ * is following then find matches without any directory. */
8292+ if (!didstar && stardepth < 100 && starstar && e - s == 2
8293+ && *path_end == '/')
8294+ {
8295+ STRCPY(s, path_end + 1);
8296+ ++stardepth;
8297+ (void)dos_expandpath(gap, buf, (int)(s - buf), flags, TRUE);
8298+ --stardepth;
8299+ }
8300+
82728301 /* Scan all files in the directory with "dir/ *.*" */
82738302 STRCPY(s, "*.*");
82748303 #ifdef WIN3264
@@ -8325,12 +8354,24 @@
83258354 namelowcpy(s, p);
83268355 #endif
83278356 len = (int)STRLEN(buf);
8357+
8358+ if (starstar && stardepth < 100)
8359+ {
8360+ /* For "**" in the pattern first go deeper in the tree to
8361+ * find matches. */
8362+ STRCPY(buf + len, "/**");
8363+ STRCPY(buf + len + 3, path_end);
8364+ ++stardepth;
8365+ (void)dos_expandpath(gap, buf, len + 1, flags, TRUE);
8366+ --stardepth;
8367+ }
8368+
83288369 STRCPY(buf + len, path_end);
83298370 if (mch_has_exp_wildcard(path_end))
83308371 {
83318372 /* need to expand another component of the path */
83328373 /* remove backslashes for the remaining components only */
8333- (void)dos_expandpath(gap, buf, len + 1, flags);
8374+ (void)dos_expandpath(gap, buf, len + 1, flags, FALSE);
83348375 }
83358376 else
83368377 {
@@ -8408,10 +8449,232 @@
84088449 char_u *path,
84098450 int flags) /* EW_* flags */
84108451 {
8411- return dos_expandpath(gap, path, 0, flags);
8452+ return dos_expandpath(gap, path, 0, flags, FALSE);
84128453 }
84138454 # endif /* MSDOS || FEAT_GUI_W16 || WIN3264 */
84148455
8456+#if (defined(UNIX) && !defined(VMS)) || defined(USE_UNIXFILENAME) \
8457+ || defined(PROTO)
8458+/*
8459+ * Unix style wildcard expansion code.
8460+ * It's here because it's used both for Unix and Mac.
8461+ */
8462+static int pstrcmp __ARGS((const void *, const void *));
8463+
8464+ static int
8465+pstrcmp(a, b)
8466+ const void *a, *b;
8467+{
8468+ return (pathcmp(*(char **)a, *(char **)b, -1));
8469+}
8470+
8471+/*
8472+ * Recursively expand one path component into all matching files and/or
8473+ * directories. Adds matches to "gap". Handles "*", "?", "[a-z]", "**", etc.
8474+ * "path" has backslashes before chars that are not to be expanded, starting
8475+ * at "path + wildoff".
8476+ * Return the number of matches found.
8477+ * NOTE: much of this is identical to dos_expandpath(), keep in sync!
8478+ */
8479+ int
8480+unix_expandpath(gap, path, wildoff, flags, didstar)
8481+ garray_T *gap;
8482+ char_u *path;
8483+ int wildoff;
8484+ int flags; /* EW_* flags */
8485+ int didstar; /* expanded "**" once already */
8486+{
8487+ char_u *buf;
8488+ char_u *path_end;
8489+ char_u *p, *s, *e;
8490+ int start_len = gap->ga_len;
8491+ char_u *pat;
8492+ regmatch_T regmatch;
8493+ int starts_with_dot;
8494+ int matches;
8495+ int len;
8496+ int starstar = FALSE;
8497+ static int stardepth = 0; /* depth for "**" expansion */
8498+
8499+ DIR *dirp;
8500+ struct dirent *dp;
8501+
8502+ /* Expanding "**" may take a long time, check for CTRL-C. */
8503+ if (stardepth > 0)
8504+ {
8505+ ui_breakcheck();
8506+ if (got_int)
8507+ return 0;
8508+ }
8509+
8510+ /* make room for file name */
8511+ buf = alloc((int)STRLEN(path) + BASENAMELEN + 5);
8512+ if (buf == NULL)
8513+ return 0;
8514+
8515+ /*
8516+ * Find the first part in the path name that contains a wildcard.
8517+ * Copy it into "buf", including the preceding characters.
8518+ */
8519+ p = buf;
8520+ s = buf;
8521+ e = NULL;
8522+ path_end = path;
8523+ while (*path_end != NUL)
8524+ {
8525+ /* May ignore a wildcard that has a backslash before it; it will
8526+ * be removed by rem_backslash() or file_pat_to_reg_pat() below. */
8527+ if (path_end >= path + wildoff && rem_backslash(path_end))
8528+ *p++ = *path_end++;
8529+ else if (*path_end == '/')
8530+ {
8531+ if (e != NULL)
8532+ break;
8533+ s = p + 1;
8534+ }
8535+ else if (path_end >= path + wildoff
8536+ && vim_strchr((char_u *)"*?[{~$", *path_end) != NULL)
8537+ e = p;
8538+#ifdef FEAT_MBYTE
8539+ if (has_mbyte)
8540+ {
8541+ len = (*mb_ptr2len_check)(path_end);
8542+ STRNCPY(p, path_end, len);
8543+ p += len;
8544+ path_end += len;
8545+ }
8546+ else
8547+#endif
8548+ *p++ = *path_end++;
8549+ }
8550+ e = p;
8551+ *e = NUL;
8552+
8553+ /* now we have one wildcard component between "s" and "e" */
8554+ /* Remove backslashes between "wildoff" and the start of the wildcard
8555+ * component. */
8556+ for (p = buf + wildoff; p < s; ++p)
8557+ if (rem_backslash(p))
8558+ {
8559+ STRCPY(p, p + 1);
8560+ --e;
8561+ --s;
8562+ }
8563+
8564+ /* Check for "**" between "s" and "e". */
8565+ for (p = s; p < e; ++p)
8566+ if (p[0] == '*' && p[1] == '*')
8567+ starstar = TRUE;
8568+
8569+ /* convert the file pattern to a regexp pattern */
8570+ starts_with_dot = (*s == '.');
8571+ pat = file_pat_to_reg_pat(s, e, NULL, FALSE);
8572+ if (pat == NULL)
8573+ {
8574+ vim_free(buf);
8575+ return 0;
8576+ }
8577+
8578+ /* compile the regexp into a program */
8579+#ifdef MACOS_X /* Can/Should we use CASE_INSENSITIVE_FILENAME instead ?*/
8580+ regmatch.rm_ic = TRUE; /* Behave like Terminal.app */
8581+#else
8582+ regmatch.rm_ic = FALSE; /* Don't ever ignore case */
8583+#endif
8584+ regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
8585+ vim_free(pat);
8586+
8587+ if (regmatch.regprog == NULL)
8588+ {
8589+ vim_free(buf);
8590+ return 0;
8591+ }
8592+
8593+ /* If "**" is by itself, this is the first time we encounter it and more
8594+ * is following then find matches without any directory. */
8595+ if (!didstar && stardepth < 100 && starstar && e - s == 2
8596+ && *path_end == '/')
8597+ {
8598+ STRCPY(s, path_end + 1);
8599+ ++stardepth;
8600+ (void)unix_expandpath(gap, buf, (int)(s - buf), flags, TRUE);
8601+ --stardepth;
8602+ }
8603+
8604+ /* open the directory for scanning */
8605+ *s = NUL;
8606+ dirp = opendir(*buf == NUL ? "." : (char *)buf);
8607+
8608+ /* Find all matching entries */
8609+ if (dirp != NULL)
8610+ {
8611+ for (;;)
8612+ {
8613+ dp = readdir(dirp);
8614+ if (dp == NULL)
8615+ break;
8616+ if ((dp->d_name[0] != '.' || starts_with_dot)
8617+ && vim_regexec(&regmatch, (char_u *)dp->d_name, (colnr_T)0))
8618+ {
8619+ STRCPY(s, dp->d_name);
8620+ len = STRLEN(buf);
8621+
8622+ if (starstar && stardepth < 100)
8623+ {
8624+ /* For "**" in the pattern first go deeper in the tree to
8625+ * find matches. */
8626+ STRCPY(buf + len, "/**");
8627+ STRCPY(buf + len + 3, path_end);
8628+ ++stardepth;
8629+ (void)unix_expandpath(gap, buf, len + 1, flags, TRUE);
8630+ --stardepth;
8631+ }
8632+
8633+ STRCPY(buf + len, path_end);
8634+ if (mch_has_exp_wildcard(path_end)) /* handle more wildcards */
8635+ {
8636+ /* need to expand another component of the path */
8637+ /* remove backslashes for the remaining components only */
8638+ (void)unix_expandpath(gap, buf, len + 1, flags, FALSE);
8639+ }
8640+ else
8641+ {
8642+ /* no more wildcards, check if there is a match */
8643+ /* remove backslashes for the remaining components only */
8644+ if (*path_end != NUL)
8645+ backslash_halve(buf + len + 1);
8646+ if (mch_getperm(buf) >= 0) /* add existing file */
8647+ {
8648+#if defined(MACOS_X) && defined(FEAT_MBYTE)
8649+ size_t precomp_len = STRLEN(buf)+1;
8650+ char_u *precomp_buf =
8651+ mac_precompose_path(buf, precomp_len, &precomp_len);
8652+ if (precomp_buf)
8653+ {
8654+ mch_memmove(buf, precomp_buf, precomp_len);
8655+ vim_free(precomp_buf);
8656+ }
8657+#endif
8658+ addfile(gap, buf, flags);
8659+ }
8660+ }
8661+ }
8662+ }
8663+
8664+ closedir(dirp);
8665+ }
8666+
8667+ vim_free(buf);
8668+ vim_free(regmatch.regprog);
8669+
8670+ matches = gap->ga_len - start_len;
8671+ if (matches > 0)
8672+ qsort(((char_u **)gap->ga_data) + start_len, matches,
8673+ sizeof(char_u *), pstrcmp);
8674+ return matches;
8675+}
8676+#endif
8677+
84158678 /*
84168679 * Generic wildcard expansion code.
84178680 *
diff -r d0d15b184c56 -r c773cb978acf src/proto/gui_riscos.pro
--- a/src/proto/gui_riscos.pro Mon Jul 25 20:42:36 2005 +0000
+++ b/src/proto/gui_riscos.pro Mon Jul 25 20:46:57 2005 +0000
@@ -15,7 +15,7 @@
1515 void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h));
1616 int gui_mch_init_font __ARGS((char_u *font_name, int do_fontset));
1717 GuiFont gui_mch_get_font __ARGS((char_u *name, int giveErrorIfMissing));
18-int gui_mch_adjust_charsize __ARGS((void));
18+int gui_mch_adjust_charheight __ARGS((void));
1919 void gui_mch_set_font __ARGS((GuiFont font));
2020 void gui_mch_set_fontset __ARGS((GuiFontset fontset));
2121 void gui_mch_free_font __ARGS((GuiFont font));
diff -r d0d15b184c56 -r c773cb978acf src/proto/gui_x11.pro
--- a/src/proto/gui_x11.pro Mon Jul 25 20:42:36 2005 +0000
+++ b/src/proto/gui_x11.pro Mon Jul 25 20:46:57 2005 +0000
@@ -16,7 +16,7 @@
1616 int gui_mch_init_font __ARGS((char_u *font_name, int do_fontset));
1717 GuiFont gui_mch_get_font __ARGS((char_u *name, int giveErrorIfMissing));
1818 char_u *gui_mch_get_fontname __ARGS((GuiFont font, char_u *name));
19-int gui_mch_adjust_charsize __ARGS((void));
19+int gui_mch_adjust_charheight __ARGS((void));
2020 void gui_mch_set_font __ARGS((GuiFont font));
2121 void gui_mch_set_fontset __ARGS((GuiFontset fontset));
2222 void gui_mch_free_font __ARGS((GuiFont font));
diff -r d0d15b184c56 -r c773cb978acf src/proto/misc1.pro
--- a/src/proto/misc1.pro Mon Jul 25 20:42:36 2005 +0000
+++ b/src/proto/misc1.pro Mon Jul 25 20:46:57 2005 +0000
@@ -84,6 +84,7 @@
8484 void fast_breakcheck __ARGS((void));
8585 int expand_wildcards __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file, int flags));
8686 int match_suffix __ARGS((char_u *fname));
87+int unix_expandpath __ARGS((garray_T *gap, char_u *path, int wildoff, int flags, int didstar));
8788 int gen_expand_wildcards __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file, int flags));
8889 void addfile __ARGS((garray_T *gap, char_u *f, int flags));
8990 char_u *get_cmd_output __ARGS((char_u *cmd, char_u *infile, int flags));
Show on old repository browser