mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 9.1.0218: Unnecessary multiplications in backspace code
Problem: Unnecessary multiplications in backspace code, as "col / ts * ts" is the same as "col - col % ts". Solution: Change "col / ts * ts" to "col - col % ts". Adjust the loop and the comments ins_bs() to be easier to understand. Update tests to reset 'smarttab' properly. (zeertzjq) closes: #14308 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
2ca7d5f483
commit
8ede7a0694
@@ -163,7 +163,7 @@ tabstop_start(colnr_T col, int ts, int *vts)
|
||||
int excess;
|
||||
|
||||
if (vts == NULL || vts[0] == 0)
|
||||
return (col / ts) * ts;
|
||||
return col - col % ts;
|
||||
|
||||
tabcount = vts[0];
|
||||
for (t = 1; t <= tabcount; ++t)
|
||||
@@ -174,7 +174,7 @@ tabstop_start(colnr_T col, int ts, int *vts)
|
||||
}
|
||||
|
||||
excess = tabcol % vts[tabcount];
|
||||
return excess + ((col - excess) / vts[tabcount]) * vts[tabcount];
|
||||
return col - (col - excess) % vts[tabcount];
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user