patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Problem: Wrong display or screenpos() result when toggling diff mode.
Solution: Reset w_skipcol when disabling 'wrap'. Reset w_leftcol when
enabling 'wrap' (zeertzjq).
fixes: #14210
closes: #14211
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/diff.c b/src/diff.c
index e1c8f58..c50670c 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1520,6 +1520,7 @@
if (!wp->w_p_diff)
wp->w_p_wrap_save = wp->w_p_wrap;
wp->w_p_wrap = FALSE;
+ wp->w_skipcol = 0;
}
# ifdef FEAT_FOLDING
if (!wp->w_p_diff)
@@ -1583,8 +1584,11 @@
wp->w_p_crb = wp->w_p_crb_save;
if (!(diff_flags & DIFF_FOLLOWWRAP))
{
- if (!wp->w_p_wrap)
- wp->w_p_wrap = wp->w_p_wrap_save;
+ if (!wp->w_p_wrap && wp->w_p_wrap_save)
+ {
+ wp->w_p_wrap = TRUE;
+ wp->w_leftcol = 0;
+ }
}
#ifdef FEAT_FOLDING
free_string_option(wp->w_p_fdm);
diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim
index b44879f..7602bd3 100644
--- a/src/testdir/test_diffmode.vim
+++ b/src/testdir/test_diffmode.vim
Binary files differ
diff --git a/src/version.c b/src/version.c
index 9f78196..c8037f7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 183,
+/**/
182,
/**/
181,