aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/diff.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-10 20:56:54 -0500
committerGitHub <noreply@github.com>2021-02-10 20:56:54 -0500
commit1aec5ba85e97889c792253424c5de9c12ddd6cf4 (patch)
tree62c78074f611cb812eb630f6e1c88eeabeae06bd /src/nvim/diff.c
parent61aea004d7101e138794a337c03ef00a6b3994e6 (diff)
parent81b4c881302640747de39f805312966c541acc47 (diff)
downloadrneovim-1aec5ba85e97889c792253424c5de9c12ddd6cf4.tar.gz
rneovim-1aec5ba85e97889c792253424c5de9c12ddd6cf4.tar.bz2
rneovim-1aec5ba85e97889c792253424c5de9c12ddd6cf4.zip
Merge pull request #13908 from janlazo/vim-8.2.2489
vim-patch:8.1.0341,8.2.{2489,2490,2492,2495,2496}
Diffstat (limited to 'src/nvim/diff.c')
-rw-r--r--src/nvim/diff.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 358725239c..31b7b1bd8f 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -58,6 +58,7 @@ static bool diff_need_update = false; // ex_diffupdate needs to be called
#define DIFF_HIDDEN_OFF 0x100 // diffoff when hidden
#define DIFF_INTERNAL 0x200 // use internal xdiff algorithm
#define DIFF_CLOSE_OFF 0x400 // diffoff when closing window
+#define DIFF_FOLLOWWRAP 0x800 // follow the wrap option
#define ALL_WHITE_DIFF (DIFF_IWHITE | DIFF_IWHITEALL | DIFF_IWHITEEOL)
static int diff_flags = DIFF_INTERNAL | DIFF_FILLER | DIFF_CLOSE_OFF;
@@ -1361,11 +1362,12 @@ void diff_win_options(win_T *wp, int addbuf)
wp->w_p_crb_save = wp->w_p_crb;
}
wp->w_p_crb = true;
-
- if (!wp->w_p_diff) {
- wp->w_p_wrap_save = wp->w_p_wrap;
+ if (!(diff_flags & DIFF_FOLLOWWRAP)) {
+ if (!wp->w_p_diff) {
+ wp->w_p_wrap_save = wp->w_p_wrap;
+ }
+ wp->w_p_wrap = false;
}
- wp->w_p_wrap = false;
curwin = wp; // -V519
curbuf = curwin->w_buffer;
@@ -1437,11 +1439,11 @@ void ex_diffoff(exarg_T *eap)
if (wp->w_p_crb) {
wp->w_p_crb = wp->w_p_crb_save;
}
-
- if (!wp->w_p_wrap) {
- wp->w_p_wrap = wp->w_p_wrap_save;
+ if (!(diff_flags & DIFF_FOLLOWWRAP)) {
+ if (!wp->w_p_wrap) {
+ wp->w_p_wrap = wp->w_p_wrap_save;
+ }
}
-
free_string_option(wp->w_p_fdm);
wp->w_p_fdm = vim_strsave(*wp->w_p_fdm_save
? wp->w_p_fdm_save
@@ -2158,6 +2160,9 @@ int diffopt_changed(void)
} else if (STRNCMP(p, "closeoff", 8) == 0) {
p += 8;
diff_flags_new |= DIFF_CLOSE_OFF;
+ } else if (STRNCMP(p, "followwrap", 10) == 0) {
+ p += 10;
+ diff_flags_new |= DIFF_FOLLOWWRAP;
} else if (STRNCMP(p, "indent-heuristic", 16) == 0) {
p += 16;
diff_indent_heuristic = XDF_INDENT_HEURISTIC;