diff src/register.c @ 18771:50fde4e20790 v8.1.2375

patch 8.1.2375: no suffucient testing for registers Commit: https://github.com/vim/vim/commit/6f1f0ca3edf395102ff3109c998d81300c8be3c9 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 1 18:16:18 2019 +0100 patch 8.1.2375: no suffucient testing for registers Problem: No suffucient testing for registers. Solution: Add more test cases. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5296) Fix that "p" on last virtual column of tab inserts spaces.
author Bram Moolenaar <Bram@vim.org>
date Sun, 01 Dec 2019 18:30:03 +0100
parents 788d76db02ac
children 8dabdfc7c799
line wrap: on
line diff
--- a/src/register.c
+++ b/src/register.c
@@ -1668,21 +1668,19 @@ do_put(
     {
 	if (gchar_cursor() == TAB)
 	{
+	    int viscol = getviscol();
+	    int ts = curbuf->b_p_ts;
+
 	    // Don't need to insert spaces when "p" on the last position of a
 	    // tab or "P" on the first position.
+	    if (dir == FORWARD ?
 #ifdef FEAT_VARTABS
-	    int viscol = getviscol();
-	    if (dir == FORWARD
-		    ? tabstop_padding(viscol, curbuf->b_p_ts,
-						    curbuf->b_p_vts_array) != 1
+		    tabstop_padding(viscol, ts, curbuf->b_p_vts_array) != 1
+#else
+		    ts - (viscol % ts) != 1
+#endif
 		    : curwin->w_cursor.coladd > 0)
 		coladvance_force(viscol);
-#else
-	    if (dir == FORWARD
-		    ? (int)curwin->w_cursor.coladd < curbuf->b_p_ts - 1
-						: curwin->w_cursor.coladd > 0)
-		coladvance_force(getviscol());
-#endif
 	    else
 		curwin->w_cursor.coladd = 0;
 	}