aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/diff.c')
-rw-r--r--src/nvim/diff.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 849204f789..5485d528f7 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -14,11 +14,13 @@
#include <stdbool.h>
#include "nvim/ascii.h"
+#include "nvim/autocmd.h"
#include "nvim/buffer.h"
#include "nvim/change.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/diff.h"
+#include "nvim/drawscreen.h"
#include "nvim/eval.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_docmd.h"
@@ -32,10 +34,10 @@
#include "nvim/move.h"
#include "nvim/normal.h"
#include "nvim/option.h"
+#include "nvim/optionstr.h"
#include "nvim/os/os.h"
#include "nvim/os/shell.h"
#include "nvim/path.h"
-#include "nvim/screen.h"
#include "nvim/strings.h"
#include "nvim/ui.h"
#include "nvim/undo.h"
@@ -956,13 +958,13 @@ void ex_diffupdate(exarg_T *eap)
// Only use the internal method if it did not fail for one of the buffers.
diffio_T diffio;
- memset(&diffio, 0, sizeof(diffio));
+ CLEAR_FIELD(diffio);
diffio.dio_internal = diff_internal() && !diff_internal_failed();
diff_try_update(&diffio, idx_orig, eap);
if (diffio.dio_internal && diff_internal_failed()) {
// Internal diff failed, use external diff instead.
- memset(&diffio, 0, sizeof(diffio));
+ CLEAR_FIELD(diffio);
diff_try_update(&diffio, idx_orig, eap);
}
@@ -1075,9 +1077,9 @@ static int diff_file_internal(diffio_T *diffio)
xdemitconf_t emit_cfg;
xdemitcb_t emit_cb;
- memset(&param, 0, sizeof(param));
- memset(&emit_cfg, 0, sizeof(emit_cfg));
- memset(&emit_cb, 0, sizeof(emit_cb));
+ CLEAR_FIELD(param);
+ CLEAR_FIELD(emit_cfg);
+ CLEAR_FIELD(emit_cb);
param.flags = (unsigned long)diff_algorithm;
@@ -1406,8 +1408,6 @@ void diff_win_options(win_T *wp, int addbuf)
}
wp->w_p_wrap = false;
}
- curwin = wp; // -V519
- curbuf = curwin->w_buffer;
if (!wp->w_p_diff) {
if (wp->w_p_diff_saved) {
@@ -1415,9 +1415,7 @@ void diff_win_options(win_T *wp, int addbuf)
}
wp->w_p_fdm_save = vim_strsave(wp->w_p_fdm);
}
- set_string_option_direct("fdm", -1, "diff", OPT_LOCAL | OPT_FREE, 0);
- curwin = old_curwin;
- curbuf = curwin->w_buffer;
+ set_string_option_direct_in_win(wp, "fdm", -1, "diff", OPT_LOCAL | OPT_FREE, 0);
if (!wp->w_p_diff) {
wp->w_p_fen_save = wp->w_p_fen;
@@ -2143,14 +2141,14 @@ int diffopt_changed(void)
long diff_algorithm_new = 0;
long diff_indent_heuristic = 0;
- char_u *p = p_dip;
+ char *p = (char *)p_dip;
while (*p != NUL) {
if (STRNCMP(p, "filler", 6) == 0) {
p += 6;
diff_flags_new |= DIFF_FILLER;
} else if ((STRNCMP(p, "context:", 8) == 0) && ascii_isdigit(p[8])) {
p += 8;
- diff_context_new = getdigits_int((char **)&p, false, diff_context_new);
+ diff_context_new = getdigits_int(&p, false, diff_context_new);
} else if (STRNCMP(p, "iblank", 6) == 0) {
p += 6;
diff_flags_new |= DIFF_IBLANK;
@@ -2174,7 +2172,7 @@ int diffopt_changed(void)
diff_flags_new |= DIFF_VERTICAL;
} else if ((STRNCMP(p, "foldcolumn:", 11) == 0) && ascii_isdigit(p[11])) {
p += 11;
- diff_foldcolumn_new = getdigits_int((char **)&p, false, diff_foldcolumn_new);
+ diff_foldcolumn_new = getdigits_int(&p, false, diff_foldcolumn_new);
} else if (STRNCMP(p, "hiddenoff", 9) == 0) {
p += 9;
diff_flags_new |= DIFF_HIDDEN_OFF;