aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/diff.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-08-04 19:37:58 +0200
committerGitHub <noreply@github.com>2018-08-04 19:37:58 +0200
commite861da247ea63024179467a9ad1923308951c0f0 (patch)
tree976cd9950743cbf49bd3bef4608c3875e1763c9c /src/nvim/diff.c
parenta4c944762315c535fc7986d734e383eccc9f1863 (diff)
parentc51c2f5a65881b2057907338099e12fa19811d41 (diff)
downloadrneovim-e861da247ea63024179467a9ad1923308951c0f0.tar.gz
rneovim-e861da247ea63024179467a9ad1923308951c0f0.tar.bz2
rneovim-e861da247ea63024179467a9ad1923308951c0f0.zip
Merge #8749 from janlazo/clint-tristate
Diffstat (limited to 'src/nvim/diff.c')
-rw-r--r--src/nvim/diff.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 61e0b76558..8699c16351 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -48,9 +48,9 @@ static int diff_flags = DIFF_FILLER;
#define LBUFLEN 50 // length of line in diff file
-// TRUE when "diff -a" works, FALSE when it doesn't work, MAYBE when not
-// checked yet
-static int diff_a_works = MAYBE;
+// kTrue when "diff -a" works, kFalse when it doesn't work,
+// kNone when not checked yet
+static TriState diff_a_works = kNone;
#ifdef INCLUDE_GENERATED_DECLARATIONS
@@ -686,9 +686,9 @@ void ex_diffupdate(exarg_T *eap)
// there are differences.
// May try twice, first with "-a" and then without.
int io_error = false;
- bool ok = false;
+ TriState ok = kFalse;
for (;;) {
- ok = false;
+ ok = kFalse;
FILE *fd = mch_fopen(tmp_orig, "w");
if (fd == NULL) {
@@ -722,7 +722,7 @@ void ex_diffupdate(exarg_T *eap)
}
if (STRNCMP(linebuf, "1c1", 3) == 0) {
- ok = TRUE;
+ ok = kTrue;
}
}
fclose(fd);
@@ -739,7 +739,7 @@ void ex_diffupdate(exarg_T *eap)
}
// If we checked if "-a" works already, break here.
- if (diff_a_works != MAYBE) {
+ if (diff_a_works != kNone) {
break;
}
diff_a_works = ok;
@@ -755,7 +755,7 @@ void ex_diffupdate(exarg_T *eap)
EMSG(_("E810: Cannot read or write temp files"));
}
EMSG(_("E97: Cannot create diffs"));
- diff_a_works = MAYBE;
+ diff_a_works = kNone;
goto theend;
}
@@ -830,7 +830,7 @@ static void diff_file(const char *const tmp_orig, const char *const tmp_new,
* differences are of no use. Ignore errors, diff returns
* non-zero when differences have been found. */
vim_snprintf(cmd, len, "diff %s%s%s%s%s %s",
- diff_a_works ? "-a " : "",
+ diff_a_works == kFalse ? "" : "-a ",
"",
(diff_flags & DIFF_IWHITE) ? "-b " : "",
(diff_flags & DIFF_ICASE) ? "-i " : "",
@@ -1486,7 +1486,7 @@ int diff_check(win_T *wp, linenr_T lnum)
}
// A closed fold never has filler lines.
- if (hasFoldingWin(wp, lnum, NULL, NULL, TRUE, NULL)) {
+ if (hasFoldingWin(wp, lnum, NULL, NULL, true, NULL)) {
return 0;
}
@@ -1793,7 +1793,7 @@ void diff_set_topline(win_T *fromwin, win_T *towin)
check_topfill(towin, false);
(void)hasFoldingWin(towin, towin->w_topline, &towin->w_topline,
- NULL, TRUE, NULL);
+ NULL, true, NULL);
}
/// This is called when 'diffopt' is changed.