From b805a7149580685edfcebcc96285e1bb96bb103d Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 11 Aug 2016 09:32:47 -0400 Subject: Re-add support for the :browse command modifier --- src/nvim/ex_cmds_defs.h | 1 + src/nvim/ex_docmd.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h index f46d1e6d47..96bfbefc16 100644 --- a/src/nvim/ex_cmds_defs.h +++ b/src/nvim/ex_cmds_defs.h @@ -176,6 +176,7 @@ typedef struct { int lockmarks; /* TRUE when ":lockmarks" was used */ int keeppatterns; /* TRUE when ":keeppatterns" was used */ bool noswapfile; /* true when ":noswapfile" was used */ + bool browse; ///< TRUE to invoke file dialog char_u *save_ei; /* saved value of 'eventignore' */ } cmdmod_T; diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 8bae817211..1e54f03ba0 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1313,8 +1313,9 @@ static char_u * do_one_cmd(char_u **cmdlinep, case 'b': if (checkforcmd(&ea.cmd, "belowright", 3)) { cmdmod.split |= WSP_BELOW; continue; - } + } if (checkforcmd(&ea.cmd, "browse", 3)) { + cmdmod.browse = true; continue; } if (!checkforcmd(&ea.cmd, "botright", 2)) -- cgit From d0c0930acfeb8d6dc299a56d2c12cd0aa3fc960f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 11 Aug 2016 09:35:17 -0400 Subject: Restore ":browse oldfiles" behavior from Vim In 3b12bb225adda2aac40a55f7009cae05311b2a43, ":oldfiles" was taught to behave like Vim's ":browse oldfiles" if ":oldfiles!" was used. However, this conflates the use of ! for abandoning a modified buffer with choosing one file out of a list of oldfiles. Now that ":browse" is supported again, ":browse oldfiles" will allow the user to select an old file, while still complaining if that would cause a modified buffer to be abandoned. ":browse oldfiles!" will just abandon the buffer, as expected. --- src/nvim/eval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 38aa587d37..f6545a5ca9 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -21722,8 +21722,8 @@ void ex_oldfiles(exarg_T *eap) /* Assume "got_int" was set to truncate the listing. */ got_int = FALSE; - // File selection prompt on ":oldfiles!" - if (eap->forceit) { + // File selection prompt on ":browse oldfiles" + if (cmdmod.browse) { quit_more = false; nr = prompt_for_number(false); msg_starthere(); -- cgit From 6aefd14482fe58d4c056bd8e1e1651640387a36e Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 11 Aug 2016 12:11:18 -0400 Subject: lint --- src/nvim/ex_cmds_defs.h | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h index 96bfbefc16..421c14b495 100644 --- a/src/nvim/ex_cmds_defs.h +++ b/src/nvim/ex_cmds_defs.h @@ -160,24 +160,22 @@ typedef struct expand { #define XP_BS_ONE 1 /* uses one backslash before a space */ #define XP_BS_THREE 2 /* uses three backslashes before a space */ -/* - * Command modifiers ":vertical", ":browse", ":confirm" and ":hide" set a flag. - * This needs to be saved for recursive commands, put them in a structure for - * easy manipulation. - */ +/// Command modifiers ":vertical", ":browse", ":confirm", ":hide", etc. set a +/// flag. This needs to be saved for recursive commands, put them in a +/// structure for easy manipulation. typedef struct { - int hide; /* TRUE when ":hide" was used */ - int split; /* flags for win_split() */ - int tab; /* > 0 when ":tab" was used */ - int confirm; /* TRUE to invoke yes/no dialog */ - int keepalt; /* TRUE when ":keepalt" was used */ - int keepmarks; /* TRUE when ":keepmarks" was used */ - int keepjumps; /* TRUE when ":keepjumps" was used */ - int lockmarks; /* TRUE when ":lockmarks" was used */ - int keeppatterns; /* TRUE when ":keeppatterns" was used */ - bool noswapfile; /* true when ":noswapfile" was used */ - bool browse; ///< TRUE to invoke file dialog - char_u *save_ei; /* saved value of 'eventignore' */ + int hide; ///< TRUE when ":hide" was used + int split; ///< flags for win_split() + int tab; ///< > 0 when ":tab" was used + int confirm; ///< TRUE to invoke yes/no dialog + int keepalt; ///< TRUE when ":keepalt" was used + int keepmarks; ///< TRUE when ":keepmarks" was used + int keepjumps; ///< TRUE when ":keepjumps" was used + int lockmarks; ///< TRUE when ":lockmarks" was used + int keeppatterns; ///< TRUE when ":keeppatterns" was used + bool noswapfile; ///< true when ":noswapfile" was used + bool browse; ///< TRUE to invoke file dialog + char_u *save_ei; ///< saved value of 'eventignore' } cmdmod_T; #endif // NVIM_EX_CMDS_DEFS_H -- cgit