Skip to content

Commit

Permalink
Support completion for ":find". (Nazri Ramliy)
Browse files Browse the repository at this point in the history
Cleanup white space.

--HG--
branch : vim73
  • Loading branch information
brammool committed Jul 14, 2010
1 parent 74a0f28 commit 6a69fb8
Show file tree
Hide file tree
Showing 32 changed files with 440 additions and 217 deletions.
1 change: 0 additions & 1 deletion runtime/doc/todo.txt
Expand Up @@ -1098,7 +1098,6 @@ Vim 7.3:
- Conceal feature: no update when moving to another window. (Dominique Pelle,
2010 Jul 5) Vince will look into it.
Patches to possibly include:
- Win32: patch for better font scaling. (George Reilly, 2009 Mar 26)
- Patch for completion of ":find" arguments. (Nazri Ramliy, 2009 Feb 22, 26)
8 For ":find" and ":sfind" expand files found in 'path'.
Update 2009 Mar 28.
Expand Down
5 changes: 3 additions & 2 deletions src/Make_mvc.mak
Expand Up @@ -1057,8 +1057,9 @@ $(OUTDIR)/window.obj: $(OUTDIR) window.c $(INCL)
$(OUTDIR)/xpm_w32.obj: $(OUTDIR) xpm_w32.c
$(CC) $(CFLAGS) $(XPM_INC) xpm_w32.c

$(OUTDIR)/vim.res: $(OUTDIR) vim.rc gvim.exe.mnf version.h tools.bmp tearoff.bmp \
vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico
$(OUTDIR)/vim.res: $(OUTDIR) vim.rc gvim.exe.mnf version.h tools.bmp \
tearoff.bmp vim.ico vim_error.ico \
vim_alert.ico vim_info.ico vim_quest.ico
$(RC) /l 0x409 /Fo$(OUTDIR)/vim.res $(RCFLAGS) vim.rc

iid_ole.c if_ole.h vim.tlb: if_ole.idl
Expand Down
8 changes: 4 additions & 4 deletions src/blowfish.c
Expand Up @@ -421,7 +421,7 @@ bf_key_init(password, salt, salt_len)
* See http://en.wikipedia.org/wiki/Key_strengthening. */
key = sha256_key(password, salt, salt_len);
for (i = 0; i < 1000; i++)
key = sha256_key(key, salt, salt_len);
key = sha256_key(key, salt, salt_len);

/* Convert the key from 64 hex chars to 32 binary chars. */
keylen = (int)STRLEN(key) / 2;
Expand All @@ -432,8 +432,8 @@ bf_key_init(password, salt, salt_len)
}
for (i = 0; i < keylen; i++)
{
sscanf((char *)&key[i * 2], "%2x", &j);
key[i] = j;
sscanf((char *)&key[i * 2], "%2x", &j);
key[i] = j;
}

mch_memmove(sbx, sbi, 4 * 4 * 256);
Expand Down Expand Up @@ -534,7 +534,7 @@ bf_self_test()
for (i = 0; i < bn; i++)
{
bf_key_init((char_u *)(bf_test_data[i].password),
bf_test_data[i].salt,
bf_test_data[i].salt,
(int)STRLEN(bf_test_data[i].salt));
if (!bf_check_tables(pax, sbx, bf_test_data[i].keysum))
err++;
Expand Down
146 changes: 73 additions & 73 deletions src/dosinst.c
Expand Up @@ -1370,10 +1370,10 @@ reg_create_key(

*phKey = NULL;
return RegCreateKeyEx(
root, subkey,
0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WOW64_64KEY | KEY_WRITE,
NULL, phKey, &disp);
root, subkey,
0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WOW64_64KEY | KEY_WRITE,
NULL, phKey, &disp);
}

static LONG
Expand All @@ -1398,8 +1398,8 @@ reg_create_key_and_value(

if (ERROR_SUCCESS == lRet)
{
lRet = reg_set_string_value(hKey, value_name, data);
RegCloseKey(hKey);
lRet = reg_set_string_value(hKey, value_name, data);
RegCloseKey(hKey);
}
return lRet;
}
Expand All @@ -1419,13 +1419,13 @@ register_inproc_server(
lRet = reg_create_key_and_value(hRootKey, subkey, NULL, extname);
if (ERROR_SUCCESS == lRet)
{
sprintf(subkey, "CLSID\\%s\\InProcServer32", clsid);
lRet = reg_create_key_and_value(hRootKey, subkey, NULL, module);
if (ERROR_SUCCESS == lRet)
{
lRet = reg_create_key_and_value(hRootKey, subkey,
sprintf(subkey, "CLSID\\%s\\InProcServer32", clsid);
lRet = reg_create_key_and_value(hRootKey, subkey, NULL, module);
if (ERROR_SUCCESS == lRet)
{
lRet = reg_create_key_and_value(hRootKey, subkey,
"ThreadingModel", threading_model);
}
}
}
return lRet;
}
Expand All @@ -1438,27 +1438,27 @@ register_shellex(
const char *exe_path)
{
LONG lRet = reg_create_key_and_value(
hRootKey,
"*\\shellex\\ContextMenuHandlers\\gvim",
NULL,
clsid);
hRootKey,
"*\\shellex\\ContextMenuHandlers\\gvim",
NULL,
clsid);

if (ERROR_SUCCESS == lRet)
{
lRet = reg_create_key_and_value(
HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved",
clsid,
name);

if (ERROR_SUCCESS == lRet)
{
lRet = reg_create_key_and_value(
HKEY_LOCAL_MACHINE,
"Software\\Vim\\Gvim",
"path",
exe_path);
}
lRet = reg_create_key_and_value(
HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved",
clsid,
name);

if (ERROR_SUCCESS == lRet)
{
lRet = reg_create_key_and_value(
HKEY_LOCAL_MACHINE,
"Software\\Vim\\Gvim",
"path",
exe_path);
}
}
return lRet;
}
Expand All @@ -1469,25 +1469,25 @@ register_openwith(
const char *exe_path)
{
LONG lRet = reg_create_key_and_value(
hRootKey,
"Applications\\gvim.exe\\shell\\edit\\command",
NULL,
exe_path);
hRootKey,
"Applications\\gvim.exe\\shell\\edit\\command",
NULL,
exe_path);

if (ERROR_SUCCESS == lRet)
{
int i;
static const char *openwith[] = {
".htm\\OpenWithList\\gvim.exe",
".vim\\OpenWithList\\gvim.exe",
"*\\OpenWithList\\gvim.exe",
};
int i;
static const char *openwith[] = {
".htm\\OpenWithList\\gvim.exe",
".vim\\OpenWithList\\gvim.exe",
"*\\OpenWithList\\gvim.exe",
};

for (i = 0; ERROR_SUCCESS == lRet
for (i = 0; ERROR_SUCCESS == lRet
&& i < sizeof(openwith) / sizeof(openwith[0]); i++)
{
lRet = reg_create_key_and_value(hRootKey, openwith[i], NULL, "");
}
{
lRet = reg_create_key_and_value(hRootKey, openwith[i], NULL, "");
}
}

return lRet;
Expand All @@ -1504,7 +1504,7 @@ register_uninstall(
"DisplayName", display_name);

if (ERROR_SUCCESS == lRet)
lRet = reg_create_key_and_value(hRootKey, appname,
lRet = reg_create_key_and_value(hRootKey, appname,
"UninstallString", uninstall_string);
return lRet;
}
Expand All @@ -1521,47 +1521,47 @@ register_uninstall(
install_registry(void)
{
#ifdef WIN3264
LONG lRet = ERROR_SUCCESS;
LONG lRet = ERROR_SUCCESS;
const char *vim_ext_ThreadingModel = "Apartment";
const char *vim_ext_name = "Vim Shell Extension";
const char *vim_ext_clsid = "{51EEE242-AD87-11d3-9C1E-0090278BBD99}";
char buf[BUFSIZE];
char vim_exe_path[BUFSIZE];
char display_name[BUFSIZE];
char uninstall_string[BUFSIZE];
char display_name[BUFSIZE];
char uninstall_string[BUFSIZE];

sprintf(vim_exe_path, "%s\\gvim.exe", installdir);

if (install_popup)
{
char bufg[BUFSIZE];
struct stat st;
char bufg[BUFSIZE];
struct stat st;

if (stat("gvimext.dll", &st) >= 0)
sprintf(bufg, "%s\\gvimext.dll", installdir);
else
/* gvimext.dll is in gvimext subdir */
sprintf(bufg, "%s\\gvimext\\gvimext.dll", installdir);
if (stat("gvimext.dll", &st) >= 0)
sprintf(bufg, "%s\\gvimext.dll", installdir);
else
/* gvimext.dll is in gvimext subdir */
sprintf(bufg, "%s\\gvimext\\gvimext.dll", installdir);

printf("Creating \"Edit with Vim\" popup menu entry\n");
printf("Creating \"Edit with Vim\" popup menu entry\n");

lRet = register_inproc_server(
HKEY_CLASSES_ROOT, vim_ext_clsid, vim_ext_name,
lRet = register_inproc_server(
HKEY_CLASSES_ROOT, vim_ext_clsid, vim_ext_name,
bufg, vim_ext_ThreadingModel);
if (ERROR_SUCCESS != lRet)
if (ERROR_SUCCESS != lRet)
return FAIL;
lRet = register_shellex(
HKEY_CLASSES_ROOT, vim_ext_clsid, vim_ext_name, vim_exe_path);
if (ERROR_SUCCESS != lRet)
lRet = register_shellex(
HKEY_CLASSES_ROOT, vim_ext_clsid, vim_ext_name, vim_exe_path);
if (ERROR_SUCCESS != lRet)
return FAIL;
}

if (install_openwith)
{
printf("Creating \"Open with ...\" list entry\n");
printf("Creating \"Open with ...\" list entry\n");

lRet = register_openwith(HKEY_CLASSES_ROOT, vim_exe_path);
if (ERROR_SUCCESS != lRet)
lRet = register_openwith(HKEY_CLASSES_ROOT, vim_exe_path);
if (ERROR_SUCCESS != lRet)
return FAIL;
}

Expand All @@ -1570,20 +1570,20 @@ install_registry(void)
/* For the NSIS installer use the generated uninstaller. */
if (interactive)
{
sprintf(display_name, "Vim " VIM_VERSION_SHORT);
sprintf(uninstall_string, "%suninstal.exe", buf);
sprintf(display_name, "Vim " VIM_VERSION_SHORT);
sprintf(uninstall_string, "%suninstal.exe", buf);
}
else
{
sprintf(display_name, "Vim " VIM_VERSION_SHORT " (self-installing)");
sprintf(uninstall_string, "%suninstall-gui.exe", buf);
sprintf(display_name, "Vim " VIM_VERSION_SHORT " (self-installing)");
sprintf(uninstall_string, "%suninstall-gui.exe", buf);
}

lRet = register_uninstall(
HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT,
display_name,
uninstall_string);
HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT,
display_name,
uninstall_string);
if (ERROR_SUCCESS != lRet)
return FAIL;
#endif /* WIN3264 */
Expand Down
16 changes: 8 additions & 8 deletions src/ex_cmds.c
Expand Up @@ -3099,8 +3099,8 @@ getfile(fnum, ffname, sfname, setpm, lnum, forceit)
* ECMD_FORCEIT: ! used for Ex command
* ECMD_ADDBUF: don't edit, just add to buffer list
* oldwin: Should be "curwin" when editing a new buffer in the current
* window, NULL when splitting the window first. When not NULL info
* of the previous buffer for "oldwin" is stored.
* window, NULL when splitting the window first. When not NULL info
* of the previous buffer for "oldwin" is stored.
*
* return FAIL for failure, OK otherwise
*/
Expand Down Expand Up @@ -7232,8 +7232,8 @@ set_context_in_sign_cmd(xp, arg)
cmd_idx = sign_cmd_idx(arg, end_subcmd);

/* :sign {subcmd} {subcmd_args}
* |
* begin_subcmd_args */
* |
* begin_subcmd_args */
begin_subcmd_args = skipwhite(end_subcmd);
p = skiptowhite(begin_subcmd_args);
if (*p == NUL)
Expand Down Expand Up @@ -7261,8 +7261,8 @@ set_context_in_sign_cmd(xp, arg)
/* expand last argument of subcmd */

/* :sign define {name} {args}...
* |
* p */
* |
* p */

/* Loop until reaching last argument. */
do
Expand All @@ -7275,8 +7275,8 @@ set_context_in_sign_cmd(xp, arg)
p = vim_strchr(last, '=');

/* :sign define {name} {args}... {last}=
* | |
* last p */
* | |
* last p */
if (p == NUL)
{
/* Expand last argument name (before equal sign). */
Expand Down
5 changes: 5 additions & 0 deletions src/ex_docmd.c
Expand Up @@ -3442,6 +3442,11 @@ set_one_cmd_context(xp, buff)
*/
switch (ea.cmdidx)
{
case CMD_find:
case CMD_sfind:
case CMD_tabfind:
xp->xp_context = EXPAND_FILES_IN_PATH;
break;
case CMD_cd:
case CMD_chdir:
case CMD_lcd:
Expand Down
7 changes: 6 additions & 1 deletion src/ex_getln.c
Expand Up @@ -4099,6 +4099,7 @@ addstar(fname, len, context)
int ends_in_star;

if (context != EXPAND_FILES
&& context != EXPAND_FILES_IN_PATH
&& context != EXPAND_SHELLCMD
&& context != EXPAND_DIRECTORIES)
{
Expand Down Expand Up @@ -4423,7 +4424,9 @@ ExpandFromContext(xp, pat, num_file, file, options)
if (options & WILD_SILENT)
flags |= EW_SILENT;

if (xp->xp_context == EXPAND_FILES || xp->xp_context == EXPAND_DIRECTORIES)
if (xp->xp_context == EXPAND_FILES
|| xp->xp_context == EXPAND_DIRECTORIES
|| xp->xp_context == EXPAND_FILES_IN_PATH)
{
/*
* Expand file or directory names.
Expand Down Expand Up @@ -4453,6 +4456,8 @@ ExpandFromContext(xp, pat, num_file, file, options)

if (xp->xp_context == EXPAND_FILES)
flags |= EW_FILE;
else if (xp->xp_context == EXPAND_FILES_IN_PATH)
flags |= (EW_FILE | EW_PATH);
else
flags = (flags | EW_DIR) & ~EW_FILE;
/* Expand wildcards, supporting %:h and the like. */
Expand Down
4 changes: 2 additions & 2 deletions src/fileio.c
Expand Up @@ -2970,8 +2970,8 @@ prepare_crypt_read(fp)
return FAIL;
method = get_crypt_method((char *)buffer,
CRYPT_MAGIC_LEN +
CRYPT_SEED_LEN_MAX +
CRYPT_SALT_LEN_MAX);
CRYPT_SEED_LEN_MAX +
CRYPT_SALT_LEN_MAX);
if (method < 0 || method != curbuf->b_p_cm)
return FAIL;

Expand Down
2 changes: 1 addition & 1 deletion src/getchar.c
Expand Up @@ -2941,7 +2941,7 @@ inchar(buf, maxlen, wait_time, tb_change_cnt)

#if defined(FEAT_NETBEANS_INTG)
/* Process the queued netbeans messages. */
netbeans_parse_messages();
netbeans_parse_messages();
#endif

if (got_int || (script_char = getc(scriptin[curscript])) < 0)
Expand Down
2 changes: 1 addition & 1 deletion src/gui.c
Expand Up @@ -1383,7 +1383,7 @@ gui_set_shellsize(mustset, fit_to_display, direction)
int screen_h;
#ifdef FEAT_GUI_GTK
int un_maximize = mustset;
int did_adjust = 0;
int did_adjust = 0;
#endif
int x = -1, y = -1;

Expand Down

0 comments on commit 6a69fb8

Please sign in to comment.