summaryrefslogtreecommitdiff
path: root/src/diff.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-03-15 22:50:30 +0000
committerBram Moolenaar <Bram@vim.org>2006-03-15 22:50:30 +0000
commitc4675a193dfbba96755e9600e5429a1aac7364f2 (patch)
treeb71c830fc683cdf8b7e5231ec51325d654224ec5 /src/diff.c
parentdb00351723c6c4ea20909fb0039e6f29ed8723ee (diff)
downloadvim-git-c4675a193dfbba96755e9600e5429a1aac7364f2.tar.gz
updated for version 7.0225
Diffstat (limited to 'src/diff.c')
-rw-r--r--src/diff.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/diff.c b/src/diff.c
index fec338263..392733834 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -21,6 +21,8 @@ static int diff_busy = FALSE; /* ex_diffgetput() is busy */
#define DIFF_FILLER 1 /* display filler lines */
#define DIFF_ICASE 2 /* ignore case */
#define DIFF_IWHITE 4 /* ignore change in white space */
+#define DIFF_HORIZONTAL 8 /* horizontal splits */
+#define DIFF_VERTICAL 16 /* vertical splits */
static int diff_flags = DIFF_FILLER;
#define LBUFLEN 50 /* length of line in diff file */
@@ -977,7 +979,7 @@ ex_diffpatch(eap)
/* don't use a new tab page, each tab page has its own diffs */
cmdmod.tab = 0;
- if (win_split(0, 0) != FAIL)
+ if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL)
{
/* Pretend it was a ":split fname" command */
eap->cmdidx = CMD_split;
@@ -1037,7 +1039,7 @@ ex_diffsplit(eap)
/* don't use a new tab page, each tab page has its own diffs */
cmdmod.tab = 0;
- if (win_split(0, 0) != FAIL)
+ if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL)
{
/* Pretend it was a ":split fname" command */
eap->cmdidx = CMD_split;
@@ -1086,7 +1088,7 @@ diff_win_options(wp, addbuf)
OPT_LOCAL|OPT_FREE, 0);
curwin = old_curwin;
curbuf = curwin->w_buffer;
- wp->w_p_fdc = 2;
+ wp->w_p_fdc = diff_foldcolumn;
wp->w_p_fen = TRUE;
wp->w_p_fdl = 0;
foldUpdateAll(wp);
@@ -1700,6 +1702,7 @@ diffopt_changed()
char_u *p;
int diff_context_new = 6;
int diff_flags_new = 0;
+ int diff_foldcolumn_new = 2;
tabpage_T *tp;
p = p_dip;
@@ -1725,12 +1728,31 @@ diffopt_changed()
p += 6;
diff_flags_new |= DIFF_IWHITE;
}
+ else if (STRNCMP(p, "horizontal", 10) == 0)
+ {
+ p += 10;
+ diff_flags_new |= DIFF_HORIZONTAL;
+ }
+ else if (STRNCMP(p, "vertical", 8) == 0)
+ {
+ p += 8;
+ diff_flags_new |= DIFF_VERTICAL;
+ }
+ else if (STRNCMP(p, "foldcolumn:", 11) == 0 && VIM_ISDIGIT(p[11]))
+ {
+ p += 11;
+ diff_foldcolumn_new = getdigits(&p);
+ }
if (*p != ',' && *p != NUL)
return FAIL;
if (*p == ',')
++p;
}
+ /* Can't have both "horizontal" and "vertical". */
+ if ((diff_flags_new & DIFF_HORIZONTAL) && (diff_flags_new & DIFF_VERTICAL))
+ return FAIL;
+
/* If "icase" or "iwhite" was added or removed, need to update the diff. */
if (diff_flags != diff_flags_new)
for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
@@ -1738,6 +1760,7 @@ diffopt_changed()
diff_flags = diff_flags_new;
diff_context = diff_context_new;
+ diff_foldcolumn = diff_foldcolumn_new;
diff_redraw(TRUE);
@@ -1749,6 +1772,15 @@ diffopt_changed()
}
/*
+ * Return TRUE if 'diffopt' contains "horizontal".
+ */
+ int
+diffopt_horizontal()
+{
+ return (diff_flags & DIFF_HORIZONTAL) != 0;
+}
+
+/*
* Find the difference within a changed line.
* Returns TRUE if the line was added, no other buffer has it.
*/