updated for version 7.4.147
Problem:    Cursor moves to wrong position when using "gj" after "$" and
            virtual editing is active.
Solution:   Make "gj" behave differently when virtual editing is active.
            (Hirohito Higashi)
diff --git a/src/normal.c b/src/normal.c
index f76aeee..66a5b7a 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -4644,7 +4644,10 @@
     }
 #endif
 
-    coladvance(curwin->w_curswant);
+    if (virtual_active() && atend)
+	coladvance(MAXCOL);
+    else
+	coladvance(curwin->w_curswant);
 
 #if defined(FEAT_LINEBREAK) || defined(FEAT_MBYTE)
     if (curwin->w_cursor.col > 0 && curwin->w_p_wrap)
diff --git a/src/testdir/test39.in b/src/testdir/test39.in
index 4f42a13..8f45f47 100644
--- a/src/testdir/test39.in
+++ b/src/testdir/test39.in
Binary files differ
diff --git a/src/testdir/test39.ok b/src/testdir/test39.ok
index 3469f52..b459355 100644
--- a/src/testdir/test39.ok
+++ b/src/testdir/test39.ok
Binary files differ
diff --git a/src/version.c b/src/version.c
index 7be350c..c9fa779 100644
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    147,
+/**/
     146,
 /**/
     145,