summaryrefslogtreecommitdiff
path: root/src/register.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-01 18:16:18 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-01 18:16:18 +0100
commit6f1f0ca3edf395102ff3109c998d81300c8be3c9 (patch)
treecb7ab8356cbd1d0ffacfc1b4d5d844d50bd3820b /src/register.c
parent269e4bd9d2a52dd55eb4b05a6d2313e705f5edee (diff)
downloadvim-git-6f1f0ca3edf395102ff3109c998d81300c8be3c9.tar.gz
patch 8.1.2375: no suffucient testing for registersv8.1.2375
Problem: No suffucient testing for registers. Solution: Add more test cases. (Yegappan Lakshmanan, closes #5296) Fix that "p" on last virtual column of tab inserts spaces.
Diffstat (limited to 'src/register.c')
-rw-r--r--src/register.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/register.c b/src/register.c
index ee7c618fe..a948bebda 100644
--- 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
- : curwin->w_cursor.coladd > 0)
- coladvance_force(viscol);
+ tabstop_padding(viscol, ts, curbuf->b_p_vts_array) != 1
#else
- if (dir == FORWARD
- ? (int)curwin->w_cursor.coladd < curbuf->b_p_ts - 1
- : curwin->w_cursor.coladd > 0)
- coladvance_force(getviscol());
+ ts - (viscol % ts) != 1
#endif
+ : curwin->w_cursor.coladd > 0)
+ coladvance_force(viscol);
else
curwin->w_cursor.coladd = 0;
}