summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r--src/ex_cmds2.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index c9834d2232..7233893b17 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -460,26 +460,33 @@ ex_listdo(exarg_T *eap)
if (curwin->w_p_wfb)
{
- if ((eap->cmdidx == CMD_ldo || eap->cmdidx == CMD_lfdo) && !eap->forceit)
- {
- // Disallow :ldo if 'winfixbuf' is applied
- semsg("%s", e_winfixbuf_cannot_go_to_buffer);
- return;
- }
-
- if (win_valid(prevwin))
- // Change the current window to another because 'winfixbuf' is enabled
- curwin = prevwin;
- else
- {
- // Split the window, which will be 'nowinfixbuf', and set curwin to that
- exarg_T new_eap;
- CLEAR_FIELD(new_eap);
- new_eap.cmdidx = CMD_split;
- new_eap.cmd = (char_u *)"split";
- new_eap.arg = (char_u *)"";
- ex_splitview(&new_eap);
- }
+ if ((eap->cmdidx == CMD_ldo || eap->cmdidx == CMD_lfdo) &&
+ !eap->forceit)
+ {
+ // Disallow :ldo if 'winfixbuf' is applied
+ emsg(_(e_winfixbuf_cannot_go_to_buffer));
+ return;
+ }
+
+ if (win_valid(prevwin) && !prevwin->w_p_wfb)
+ {
+ // 'winfixbuf' is set; attempt to change to a window without it.
+ win_goto(prevwin);
+ }
+ if (curwin->w_p_wfb)
+ {
+ // Split the window, which will be 'nowinfixbuf', and set curwin to
+ // that
+ win_split(0, 0);
+
+ if (curwin->w_p_wfb)
+ {
+ // Autocommands set 'winfixbuf' or sent us to another window
+ // with it set. Give up.
+ emsg(_(e_winfixbuf_cannot_go_to_buffer));
+ return;
+ }
+ }
}
#if defined(FEAT_SYN_HL)