Mercurial > vim
comparison src/ex_cmds.c @ 26026:db9fdfb86679 v8.2.3547
patch 8.2.3547: opening the quickfix window triggers BufWinEnter twice
Commit: https://github.com/vim/vim/commit/1d30fde3c989a962e0e1af4cbcf90e1ea483f1f4
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Oct 20 21:58:42 2021 +0100
patch 8.2.3547: opening the quickfix window triggers BufWinEnter twice
Problem: Opening the quickfix window triggers BufWinEnter twice. (Yorick
Peterse)
Solution: Only trigger BufWinEnter with "quickfix". (closes #9022)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 20 Oct 2021 23:00:05 +0200 |
parents | dbf6a2066091 |
children | a2e6da79274d |
comparison
equal
deleted
inserted
replaced
26025:480c0f6e2822 | 26026:db9fdfb86679 |
---|---|
2471 * ECMD_SET_HELP: set b_help flag of (new) buffer before opening file | 2471 * ECMD_SET_HELP: set b_help flag of (new) buffer before opening file |
2472 * ECMD_OLDBUF: use existing buffer if it exists | 2472 * ECMD_OLDBUF: use existing buffer if it exists |
2473 * ECMD_FORCEIT: ! used for Ex command | 2473 * ECMD_FORCEIT: ! used for Ex command |
2474 * ECMD_ADDBUF: don't edit, just add to buffer list | 2474 * ECMD_ADDBUF: don't edit, just add to buffer list |
2475 * ECMD_ALTBUF: like ECMD_ADDBUF and also set the alternate file | 2475 * ECMD_ALTBUF: like ECMD_ADDBUF and also set the alternate file |
2476 * ECMD_NOWINENTER: Do not trigger BufWinEnter | |
2476 * oldwin: Should be "curwin" when editing a new buffer in the current | 2477 * oldwin: Should be "curwin" when editing a new buffer in the current |
2477 * window, NULL when splitting the window first. When not NULL info | 2478 * window, NULL when splitting the window first. When not NULL info |
2478 * of the previous buffer for "oldwin" is stored. | 2479 * of the previous buffer for "oldwin" is stored. |
2479 * | 2480 * |
2480 * return FAIL for failure, OK otherwise | 2481 * return FAIL for failure, OK otherwise |
3028 curbuf->b_flags |= BF_CHECK_RO; // set/reset 'ro' flag | 3029 curbuf->b_flags |= BF_CHECK_RO; // set/reset 'ro' flag |
3029 | 3030 |
3030 /* | 3031 /* |
3031 * Open the buffer and read the file. | 3032 * Open the buffer and read the file. |
3032 */ | 3033 */ |
3034 if (flags & ECMD_NOWINENTER) | |
3035 readfile_flags |= READ_NOWINENTER; | |
3033 #if defined(FEAT_EVAL) | 3036 #if defined(FEAT_EVAL) |
3034 if (should_abort(open_buffer(FALSE, eap, readfile_flags))) | 3037 if (should_abort(open_buffer(FALSE, eap, readfile_flags))) |
3035 retval = FAIL; | 3038 retval = FAIL; |
3036 #else | 3039 #else |
3037 (void)open_buffer(FALSE, eap, readfile_flags); | 3040 (void)open_buffer(FALSE, eap, readfile_flags); |
3049 // Read the modelines, but only to set window-local options. Any | 3052 // Read the modelines, but only to set window-local options. Any |
3050 // buffer-local options have already been set and may have been | 3053 // buffer-local options have already been set and may have been |
3051 // changed by the user. | 3054 // changed by the user. |
3052 do_modelines(OPT_WINONLY); | 3055 do_modelines(OPT_WINONLY); |
3053 | 3056 |
3054 apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf, | 3057 apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, |
3055 &retval); | 3058 curbuf, &retval); |
3056 apply_autocmds_retval(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf, | 3059 if ((flags & ECMD_NOWINENTER) == 0) |
3057 &retval); | 3060 apply_autocmds_retval(EVENT_BUFWINENTER, NULL, NULL, FALSE, |
3061 curbuf, &retval); | |
3058 } | 3062 } |
3059 check_arg_idx(curwin); | 3063 check_arg_idx(curwin); |
3060 | 3064 |
3061 // If autocommands change the cursor position or topline, we should | 3065 // If autocommands change the cursor position or topline, we should |
3062 // keep it. Also when it moves within a line. But not when it moves | 3066 // keep it. Also when it moves within a line. But not when it moves |