Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove FEAT_BROWSE #173

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions src/diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1152,27 +1152,10 @@ void ex_diffpatch(exarg_T *eap)
#ifdef UNIX
char_u dirbuf[MAXPATHL];
char_u *fullname = NULL;
#endif
#ifdef FEAT_BROWSE
char_u *browseFile = NULL;
int browse_flag = cmdmod.browse;
#endif
stat_T st;
char_u *esc_name = NULL;

#ifdef FEAT_BROWSE
if (cmdmod.browse)
{
browseFile = do_browse(0, (char_u *)_("Patch file"),
eap->arg, NULL, NULL,
(char_u *)_(BROWSE_FILTER_ALL_FILES), NULL);
if (browseFile == NULL)
return; /* operation cancelled */
eap->arg = browseFile;
cmdmod.browse = FALSE; /* don't let do_ecmd() browse again */
}
#endif

/* We need two temp file names. */
tmp_orig = vim_tempname('o', FALSE);
tmp_new = vim_tempname('n', FALSE);
Expand Down Expand Up @@ -1320,10 +1303,6 @@ void ex_diffpatch(exarg_T *eap)
vim_free(fullname);
#endif
vim_free(esc_name);
#ifdef FEAT_BROWSE
vim_free(browseFile);
cmdmod.browse = browse_flag;
#endif
}

/*
Expand Down
40 changes: 0 additions & 40 deletions src/evalfunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1690,29 +1690,7 @@ f_atan2(typval_T *argvars, typval_T *rettv)
static void
f_browse(typval_T *argvars UNUSED, typval_T *rettv)
{
#ifdef FEAT_BROWSE
int save;
char_u *title;
char_u *initdir;
char_u *defname;
char_u buf[NUMBUFLEN];
char_u buf2[NUMBUFLEN];
int error = FALSE;

save = (int)tv_get_number_chk(&argvars[0], &error);
title = tv_get_string_chk(&argvars[1]);
initdir = tv_get_string_buf_chk(&argvars[2], buf);
defname = tv_get_string_buf_chk(&argvars[3], buf2);

if (error || title == NULL || initdir == NULL || defname == NULL)
rettv->vval.v_string = NULL;
else
rettv->vval.v_string =
do_browse(save ? BROWSE_SAVE : 0,
title, defname, NULL, initdir, NULL, curbuf);
#else
rettv->vval.v_string = NULL;
#endif
rettv->v_type = VAR_STRING;
}

Expand All @@ -1722,22 +1700,7 @@ f_browse(typval_T *argvars UNUSED, typval_T *rettv)
static void
f_browsedir(typval_T *argvars UNUSED, typval_T *rettv)
{
#ifdef FEAT_BROWSE
char_u *title;
char_u *initdir;
char_u buf[NUMBUFLEN];

title = tv_get_string_chk(&argvars[0]);
initdir = tv_get_string_buf_chk(&argvars[1], buf);

if (title == NULL || initdir == NULL)
rettv->vval.v_string = NULL;
else
rettv->vval.v_string = do_browse(BROWSE_DIR,
title, NULL, NULL, initdir, NULL, curbuf);
#else
rettv->vval.v_string = NULL;
#endif
rettv->v_type = VAR_STRING;
}

Expand Down Expand Up @@ -5966,9 +5929,6 @@ f_has(typval_T *argvars, typval_T *rettv)
"all_builtin_terms",
#endif
#endif
#if defined(FEAT_BROWSE) && defined(USE_FILE_CHOOSER)
"browsefilter",
#endif
#ifdef FEAT_BYTEOFF
"byte_offset",
#endif
Expand Down
73 changes: 1 addition & 72 deletions src/ex_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -3084,26 +3084,14 @@ int do_write(exarg_T *eap)
char_u *ffname;
int retval = FAIL;
char_u *free_fname = NULL;
#ifdef FEAT_BROWSE
char_u *browse_file = NULL;
#endif
buf_T *alt_buf = NULL;
int name_was_missing;

if (not_writing()) /* check 'write' option */
return FAIL;

ffname = eap->arg;
#ifdef FEAT_BROWSE
if (cmdmod.browse)
{
browse_file = do_browse(BROWSE_SAVE, (char_u *)_("Save As"), ffname,
NULL, NULL, NULL, curbuf);
if (browse_file == NULL)
goto theend;
ffname = browse_file;
}
#endif

if (*ffname == NUL)
{
if (eap->cmdidx == CMD_saveas)
Expand Down Expand Up @@ -3260,9 +3248,6 @@ int do_write(exarg_T *eap)
}

theend:
#ifdef FEAT_BROWSE
vim_free(browse_file);
#endif
vim_free(free_fname);
return retval;
}
Expand Down Expand Up @@ -3406,11 +3391,6 @@ void do_wqall(exarg_T *eap)
++error;
break;
}
#ifdef FEAT_BROWSE
/* ":browse wall": ask for file name if there isn't one */
if (buf->b_ffname == NULL && cmdmod.browse)
browse_save_fname(buf);
#endif
if (buf->b_ffname == NULL)
{
semsg(_("E141: No file name for buffer %ld"), (long)buf->b_fnum);
Expand Down Expand Up @@ -3610,9 +3590,6 @@ int do_ecmd(
bufref_T bufref;
bufref_T old_curbuf;
char_u *free_fname = NULL;
#ifdef FEAT_BROWSE
char_u *browse_file = NULL;
#endif
int retval = FAIL;
long n;
pos_T orig_pos;
Expand All @@ -3637,27 +3614,6 @@ int do_ecmd(
}
else
{
#ifdef FEAT_BROWSE
if (cmdmod.browse)
{
if (
au_has_group((char_u *)"FileExplorer"))
{
/* No browsing supported but we do have the file explorer:
* Edit the directory. */
if (ffname == NULL || !mch_isdir(ffname))
ffname = (char_u *)".";
}
else
{
browse_file = do_browse(0, (char_u *)_("Edit File"), ffname,
NULL, NULL, NULL, curbuf);
if (browse_file == NULL)
goto theend;
ffname = browse_file;
}
}
#endif
/* if no short name given, use ffname for short name */
if (sfname == NULL)
sfname = ffname;
Expand Down Expand Up @@ -4221,9 +4177,6 @@ int do_ecmd(
#if defined(FEAT_EVAL)
if (did_set_swapcommand)
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
#endif
#ifdef FEAT_BROWSE
vim_free(browse_file);
#endif
vim_free(free_fname);
return retval;
Expand Down Expand Up @@ -7351,30 +7304,6 @@ void ex_oldfiles(exarg_T *eap UNUSED)

/* Assume "got_int" was set to truncate the listing. */
got_int = FALSE;

#ifdef FEAT_BROWSE_CMD
if (cmdmod.browse)
{
quit_more = FALSE;
nr = prompt_for_number(FALSE);
msg_starthere();
if (nr > 0)
{
char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
(long)nr);

if (p != NULL)
{
p = expand_env_save(p);
eap->arg = p;
eap->cmdidx = CMD_edit;
cmdmod.browse = FALSE;
do_exedit(eap, NULL);
vim_free(p);
}
}
}
#endif
}
}
#endif
18 changes: 1 addition & 17 deletions src/ex_cmds2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2850,23 +2850,7 @@ void ex_pyxdo(exarg_T *eap)
*/
void ex_source(exarg_T *eap)
{
#ifdef FEAT_BROWSE
if (cmdmod.browse)
{
char_u *fname = NULL;

fname = do_browse(0, (char_u *)_("Source Vim script"), eap->arg,
NULL, NULL,
(char_u *)_(BROWSE_FILTER_MACROS), NULL);
if (fname != NULL)
{
cmd_source(fname, eap);
vim_free(fname);
}
}
else
#endif
cmd_source(eap->arg, eap);
cmd_source(eap->arg, eap);
}

static void
Expand Down
Loading