diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-06-05 16:01:59 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-06-05 16:01:59 +0200 |
commit | 8ad80dea089ffeb1a845199c013e9bb4be1cd22e (patch) | |
tree | 8acbc6f87058076a9965d14ac10e8d37e57f0aa0 /src/ex_cmds.c | |
parent | b463e8d999ec812d656876f313efbeaeed663b45 (diff) | |
download | vim-git-8ad80dea089ffeb1a845199c013e9bb4be1cd22e.tar.gz |
patch 8.0.0621: :stag does not respect 'switchbuf'v8.0.0621
Problem: The ":stag" command does not respect 'switchbuf'.
Solution: Check 'switchbuf' for tag commands that may open a new window.
(Ingo Karkat, closes #1681) Define macros for the return values
of getfile().
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r-- | src/ex_cmds.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 309474ce0..70f01453b 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -3520,11 +3520,14 @@ check_readonly(int *forceit, buf_T *buf) /* * Try to abandon current file and edit a new or existing file. - * 'fnum' is the number of the file, if zero use ffname/sfname. + * "fnum" is the number of the file, if zero use ffname/sfname. + * "lnum" is the line number for the cursor in the new file (if non-zero). * - * Return 1 for "normal" error, 2 for "not written" error, 0 for success - * -1 for successfully opening another file. - * 'lnum' is the line number for the cursor in the new file (if non-zero). + * Return: + * GETFILE_ERROR for "normal" error, + * GETFILE_NOT_WRITTEN for "not written" error, + * GETFILE_SAME_FILE for success + * GETFILE_OPEN_OTHER for successfully opening another file. */ int getfile( @@ -3540,10 +3543,10 @@ getfile( char_u *free_me = NULL; if (text_locked()) - return 1; + return GETFILE_ERROR; #ifdef FEAT_AUTOCMD if (curbuf_locked()) - return 1; + return GETFILE_ERROR; #endif if (fnum == 0) @@ -3570,7 +3573,7 @@ getfile( if (other) --no_wait_return; EMSG(_(e_nowrtmsg)); - retval = 2; /* file has been changed */ + retval = GETFILE_NOT_WRITTEN; /* file has been changed */ goto theend; } } @@ -3584,14 +3587,14 @@ getfile( curwin->w_cursor.lnum = lnum; check_cursor_lnum(); beginline(BL_SOL | BL_FIX); - retval = 0; /* it's in the same file */ + retval = GETFILE_SAME_FILE; /* it's in the same file */ } else if (do_ecmd(fnum, ffname, sfname, NULL, lnum, (P_HID(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0), curwin) == OK) - retval = -1; /* opened another file */ + retval = GETFILE_OPEN_OTHER; /* opened another file */ else - retval = 1; /* error encountered */ + retval = GETFILE_ERROR; /* error encountered */ theend: vim_free(free_me); |