comparison src/misc1.c @ 7635:1506f86b120f v7.4.1117

commit https://github.com/vim/vim/commit/d82103ed8534a1207742e9666ac7ef1e47dda12d Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 17 17:04:05 2016 +0100 patch 7.4.1117 Problem: No longer get "." and ".." in directory list. Solution: Do not skip "." and ".." unless EW_DODOT is set.
author Christian Brabandt <cb@256bit.org>
date Sun, 17 Jan 2016 17:15:04 +0100
parents 2a280b8e7040
children b44fc33ef92a
comparison
equal deleted inserted replaced
7634:39dc10ad4b19 7635:1506f86b120f
10011 /* Check for "**" between "s" and "e". */ 10011 /* Check for "**" between "s" and "e". */
10012 for (p = s; p < e; ++p) 10012 for (p = s; p < e; ++p)
10013 if (p[0] == '*' && p[1] == '*') 10013 if (p[0] == '*' && p[1] == '*')
10014 starstar = TRUE; 10014 starstar = TRUE;
10015 10015
10016 starts_with_dot = *s == '.' || (flags & EW_DODOT); 10016 starts_with_dot = *s == '.';
10017 pat = file_pat_to_reg_pat(s, e, NULL, FALSE); 10017 pat = file_pat_to_reg_pat(s, e, NULL, FALSE);
10018 if (pat == NULL) 10018 if (pat == NULL)
10019 { 10019 {
10020 vim_free(buf); 10020 vim_free(buf);
10021 return 0; 10021 return 0;
10094 #else 10094 #else
10095 p = (char_u *)fb.ff_name; 10095 p = (char_u *)fb.ff_name;
10096 #endif 10096 #endif
10097 /* Ignore entries starting with a dot, unless when asked for. Accept 10097 /* Ignore entries starting with a dot, unless when asked for. Accept
10098 * all entries found with "matchname". */ 10098 * all entries found with "matchname". */
10099 if ((p[0] != '.' || (starts_with_dot 10099 if ((p[0] != '.' || starts_with_dot
10100 && p[1] != NUL && (p[1] != '.' || p[2] != NUL))) 10100 || ((flags & EW_DODOT)
10101 && p[1] != NUL && (p[1] != '.' || p[2] != NUL)))
10101 && (matchname == NULL 10102 && (matchname == NULL
10102 || (regmatch.regprog != NULL 10103 || (regmatch.regprog != NULL
10103 && vim_regexec(&regmatch, p, (colnr_T)0)) 10104 && vim_regexec(&regmatch, p, (colnr_T)0))
10104 || ((flags & EW_NOTWILD) 10105 || ((flags & EW_NOTWILD)
10105 && fnamencmp(path + (s - buf), p, e - s) == 0))) 10106 && fnamencmp(path + (s - buf), p, e - s) == 0)))
10324 for (p = s; p < e; ++p) 10325 for (p = s; p < e; ++p)
10325 if (p[0] == '*' && p[1] == '*') 10326 if (p[0] == '*' && p[1] == '*')
10326 starstar = TRUE; 10327 starstar = TRUE;
10327 10328
10328 /* convert the file pattern to a regexp pattern */ 10329 /* convert the file pattern to a regexp pattern */
10329 starts_with_dot = *s == '.' || (flags & EW_DODOT); 10330 starts_with_dot = *s == '.';
10330 pat = file_pat_to_reg_pat(s, e, NULL, FALSE); 10331 pat = file_pat_to_reg_pat(s, e, NULL, FALSE);
10331 if (pat == NULL) 10332 if (pat == NULL)
10332 { 10333 {
10333 vim_free(buf); 10334 vim_free(buf);
10334 return 0; 10335 return 0;
10373 for (;;) 10374 for (;;)
10374 { 10375 {
10375 dp = readdir(dirp); 10376 dp = readdir(dirp);
10376 if (dp == NULL) 10377 if (dp == NULL)
10377 break; 10378 break;
10378 if ((dp->d_name[0] != '.' || (starts_with_dot 10379 if ((dp->d_name[0] != '.' || starts_with_dot
10379 && dp->d_name[1] != NUL 10380 || ((flags & EW_DODOT)
10380 && (dp->d_name[1] != '.' || dp->d_name[2] != NUL))) 10381 && dp->d_name[1] != NUL
10382 && (dp->d_name[1] != '.' || dp->d_name[2] != NUL)))
10381 && ((regmatch.regprog != NULL && vim_regexec(&regmatch, 10383 && ((regmatch.regprog != NULL && vim_regexec(&regmatch,
10382 (char_u *)dp->d_name, (colnr_T)0)) 10384 (char_u *)dp->d_name, (colnr_T)0))
10383 || ((flags & EW_NOTWILD) 10385 || ((flags & EW_NOTWILD)
10384 && fnamencmp(path + (s - buf), dp->d_name, e - s) == 0))) 10386 && fnamencmp(path + (s - buf), dp->d_name, e - s) == 0)))
10385 { 10387 {