patch 9.0.2081: smoothscroll may result in wrong cursor position

Problem:  With 'smoothscroll' set, "w_skipcol" is not reset when unsetting 'wrap'.
          Resulting in incorrect calculation of the cursor position.
Solution: Reset "w_skipcol" when unsetting 'wrap'.

fixes:  #12970
closes: #13439

Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim
index ef2d3bd..f65654d 100644
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -2207,4 +2207,20 @@
   let &term = term
 endfunc
 
+func Test_set_wrap()
+  " Unsetting 'wrap' when 'smoothscroll' is set does not result in incorrect
+  " cursor position.
+  set wrap smoothscroll scrolloff=5
+
+  call setline(1, ['', 'aaaa'->repeat(500)])
+  20 split
+  20 vsplit
+  norm 2G$
+  redraw
+  set nowrap
+  call assert_equal(2, winline())
+
+  set wrap& smoothscroll& scrolloff&
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab