summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/buffer.c11
-rw-r--r--src/diff.c11
-rw-r--r--src/ex_cmds.c9
-rw-r--r--src/ex_cmds2.c4
-rw-r--r--src/ex_docmd.c8
-rw-r--r--src/ex_getln.c4
-rw-r--r--src/if_cscope.c4
-rw-r--r--src/macros.h14
-rw-r--r--src/quickfix.c8
-rw-r--r--src/search.c4
-rw-r--r--src/tag.c4
-rw-r--r--src/version.c2
-rw-r--r--src/window.c14
13 files changed, 45 insertions, 52 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 5e885b905..0850baedd 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1288,9 +1288,12 @@ do_buffer(action, start, dir, count, forceit)
/* Go to the other buffer. */
set_curbuf(buf, action);
-#if defined(FEAT_LISTCMDS) && defined(FEAT_SCROLLBIND)
+#if defined(FEAT_LISTCMDS) \
+ && (defined(FEAT_SCROLLBIND) || defined(FEAT_CURSORBIND))
if (action == DOBUF_SPLIT)
- curwin->w_p_scb = FALSE; /* reset 'scrollbind' */
+ {
+ RESET_BINDING(curwin); /* reset 'scrollbind' and 'cursorbind' */
+ }
#endif
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
@@ -1917,9 +1920,7 @@ buflist_getfile(n, lnum, options, forceit)
tabpage_new();
else if (win_split(0, 0) == FAIL) /* Open in a new window */
return FAIL;
-# ifdef FEAT_SCROLLBIND
- curwin->w_p_scb = FALSE;
-# endif
+ RESET_BINDING(curwin);
}
}
#endif
diff --git a/src/diff.c b/src/diff.c
index 9b6d2791f..5844ec923 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1127,11 +1127,13 @@ diff_win_options(wp, addbuf)
# endif
wp->w_p_diff = TRUE;
+ /* Use 'scrollbind' and 'cursorbind' when available */
+#ifdef FEAT_SCROLLBIND
+ wp->w_p_scb = TRUE;
+#endif
#ifdef FEAT_CURSORBIND
- /* Use cursorbind if it's available */
wp->w_p_crb = TRUE;
#endif
- wp->w_p_scb = TRUE;
wp->w_p_wrap = FALSE;
# ifdef FEAT_FOLDING
curwin = wp;
@@ -1177,10 +1179,7 @@ ex_diffoff(eap)
{
/* Set 'diff', 'scrollbind' off and 'wrap' on. */
wp->w_p_diff = FALSE;
-#ifdef FEAT_CURSORBIND
- wp->w_p_crb = FALSE;
-#endif
- wp->w_p_scb = FALSE;
+ RESET_BINDING(wp);
wp->w_p_wrap = TRUE;
#ifdef FEAT_FOLDING
curwin = wp;
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index f78bf9643..d53652fda 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3498,9 +3498,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
curbuf->b_p_bin = FALSE; /* reset 'bin' before reading file */
curwin->w_p_nu = 0; /* no line numbers */
curwin->w_p_rnu = 0; /* no relative line numbers */
-#ifdef FEAT_SCROLLBIND
- curwin->w_p_scb = FALSE; /* no scroll binding */
-#endif
+ RESET_BINDING(curwin); /* no scroll or cursor binding */
#ifdef FEAT_ARABIC
curwin->w_p_arab = FALSE; /* no arabic mode */
#endif
@@ -5471,9 +5469,8 @@ prepare_tagpreview(undo_sync)
return FALSE;
curwin->w_p_pvw = TRUE;
curwin->w_p_wfh = TRUE;
-# ifdef FEAT_SCROLLBIND
- curwin->w_p_scb = FALSE; /* don't take over 'scrollbind' */
-# endif
+ RESET_BINDING(curwin); /* don't take over 'scrollbind'
+ and 'cursorbind' */
# ifdef FEAT_DIFF
curwin->w_p_diff = FALSE; /* no 'diff' */
# endif
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index f7ffb087a..8a7498a58 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -2165,9 +2165,7 @@ do_argfile(eap, argn)
{
if (win_split(0, 0) == FAIL)
return;
-# ifdef FEAT_SCROLLBIND
- curwin->w_p_scb = FALSE;
-# endif
+ RESET_BINDING(curwin);
}
else
#endif
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 657742e5a..0940ad862 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -6898,9 +6898,7 @@ handle_drop(filec, filev, split)
# ifdef FEAT_WINDOWS
if (win_split(0, 0) == FAIL)
return;
-# ifdef FEAT_SCROLLBIND
- curwin->w_p_scb = FALSE;
-# endif
+ RESET_BINDING(curwin);
/* When splitting the window, create a new alist. Otherwise the
* existing one is overwritten. */
@@ -7300,7 +7298,9 @@ ex_splitview(eap)
|| cmdmod.browse
# endif
)
- curwin->w_p_scb = FALSE;
+ {
+ RESET_BINDING(curwin);
+ }
else
do_check_scrollbind(FALSE);
# endif
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 79a10466e..396f686bf 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -6147,9 +6147,7 @@ ex_window()
curwin->w_p_rl = cmdmsg_rl;
cmdmsg_rl = FALSE;
# endif
-# ifdef FEAT_SCROLLBIND
- curwin->w_p_scb = FALSE;
-# endif
+ RESET_BINDING(curwin);
# ifdef FEAT_AUTOCMD
/* Do execute autocommands for setting the filetype (load syntax). */
diff --git a/src/if_cscope.c b/src/if_cscope.c
index 3ee718321..1a377da85 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -1274,9 +1274,7 @@ cs_find_common(opt, pat, forceit, verbose, use_ll, cmdline)
{
win_split(postponed_split > 0 ? postponed_split : 0,
postponed_split_flags);
-# ifdef FEAT_SCROLLBIND
- curwin->w_p_scb = FALSE;
-# endif
+ RESET_BINDING(curwin);
postponed_split = 0;
}
# endif
diff --git a/src/macros.h b/src/macros.h
index 599b40398..be3af9a5c 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -285,3 +285,17 @@
#else
# define DO_AUTOCHDIR
#endif
+
+#if defined(FEAT_SCROLLBIND) && defined(FEAT_CURSORBIND)
+# define RESET_BINDING(wp) (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE
+#else
+# if defined(FEAT_SCROLLBIND)
+# define RESET_BINDING(wp) (wp)->w_p_scb = FALSE
+# else
+# if defined(FEAT_CURSORBIND)
+# define RESET_BINDING(wp) (wp)->w_p_crb = FALSE
+# else
+# define RESET_BINDING(wp)
+# endif
+# endif
+#endif
diff --git a/src/quickfix.c b/src/quickfix.c
index 7ff431834..024952379 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -1656,9 +1656,7 @@ win_found:
opened_window = TRUE; /* close it when fail */
p_swb = empty_option; /* don't split again */
swb_flags = 0;
-# ifdef FEAT_SCROLLBIND
- curwin->w_p_scb = FALSE;
-# endif
+ RESET_BINDING(curwin);
if (ll_ref != NULL)
{
/* The new window should use the location list from the
@@ -2334,9 +2332,7 @@ ex_copen(eap)
win_goto(lastwin);
if (win_split(height, WSP_BELOW | WSP_NEWLOC) == FAIL)
return; /* not enough room for window */
-#ifdef FEAT_SCROLLBIND
- curwin->w_p_scb = FALSE;
-#endif
+ RESET_BINDING(curwin);
if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
{
diff --git a/src/search.c b/src/search.c
index 26dac9d20..1c971ffda 100644
--- a/src/search.c
+++ b/src/search.c
@@ -5075,9 +5075,7 @@ search_line:
if (win_split(0, 0) == FAIL)
#endif
break;
-#ifdef FEAT_SCROLLBIND
- curwin->w_p_scb = FALSE;
-#endif
+ RESET_BINDING(curwin);
}
if (depth == -1)
{
diff --git a/src/tag.c b/src/tag.c
index fdd8dec95..50c3ce692 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -3143,9 +3143,7 @@ jumpto_tag(lbuf, forceit, keep_help)
{
win_split(postponed_split > 0 ? postponed_split : 0,
postponed_split_flags);
-# ifdef FEAT_SCROLLBIND
- curwin->w_p_scb = FALSE;
-# endif
+ RESET_BINDING(curwin);
}
#endif
diff --git a/src/version.c b/src/version.c
index ab8f35e8b..d4a22da8d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -715,6 +715,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 8,
+/**/
7,
/**/
6,
diff --git a/src/window.c b/src/window.c
index 4b721eaa7..7a2b1012f 100644
--- a/src/window.c
+++ b/src/window.c
@@ -525,9 +525,7 @@ wingotofile:
setpcmark();
if (win_split(0, 0) == OK)
{
-# ifdef FEAT_SCROLLBIND
- curwin->w_p_scb = FALSE;
-# endif
+ RESET_BINDING(curwin);
(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL,
ECMD_HIDE, NULL);
if (nchar == 'F' && lnum >= 0)
@@ -3277,9 +3275,7 @@ win_alloc_aucmd_win()
if (aucmd_win != NULL)
{
win_init_some(aucmd_win, curwin);
-# ifdef FEAT_SCROLLBIND
- aucmd_win->w_p_scb = FALSE;
-# endif
+ RESET_BINDING(aucmd_win);
new_frame(aucmd_win);
}
}
@@ -3320,10 +3316,8 @@ win_alloc_firstwin(oldwin)
/* First window in new tab page, initialize it from "oldwin". */
win_init(curwin, oldwin, 0);
-# ifdef FEAT_SCROLLBIND
- /* We don't want scroll-binding in the first window. */
- curwin->w_p_scb = FALSE;
-# endif
+ /* We don't want cursor- and scroll-binding in the first window. */
+ RESET_BINDING(curwin);
}
#endif