comparison src/option.c @ 14218:539b070778b0 v8.1.0126

patch 8.1.0126: various problems with 'vartabstop' commit https://github.com/vim/vim/commit/307ac5c68e9e624ab713136d79f35bb73f780d2d Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 28 22:23:00 2018 +0200 patch 8.1.0126: various problems with 'vartabstop' Problem: Various problems with 'vartabstop'. Solution: Fix memory leak. Fix crash. Add a few more tests. (Christian Brabandt, closes #3076)
author Christian Brabandt <cb@256bit.org>
date Thu, 28 Jun 2018 22:30:06 +0200
parents 2bebc49116fd
children fbf0681606fa
comparison
equal deleted inserted replaced
14217:30af25836c8d 14218:539b070778b0
12868 */ 12868 */
12869 void 12869 void
12870 tabstop_fromto( 12870 tabstop_fromto(
12871 colnr_T start_col, 12871 colnr_T start_col,
12872 colnr_T end_col, 12872 colnr_T end_col,
12873 int ts, 12873 int ts_arg,
12874 int *vts, 12874 int *vts,
12875 int *ntabs, 12875 int *ntabs,
12876 int *nspcs) 12876 int *nspcs)
12877 { 12877 {
12878 int spaces = end_col - start_col; 12878 int spaces = end_col - start_col;
12879 colnr_T tabcol = 0; 12879 colnr_T tabcol = 0;
12880 int padding = 0; 12880 int padding = 0;
12881 int tabcount; 12881 int tabcount;
12882 int t; 12882 int t;
12883 int ts = ts_arg == 0 ? curbuf->b_p_ts : ts_arg;
12883 12884
12884 if (vts == NULL || vts[0] == 0) 12885 if (vts == NULL || vts[0] == 0)
12885 { 12886 {
12886 int tabs = 0; 12887 int tabs = 0;
12887 int initspc = ts - (start_col % ts); 12888 int initspc = 0;
12888 12889
12890 initspc = ts - (start_col % ts);
12889 if (spaces >= initspc) 12891 if (spaces >= initspc)
12890 { 12892 {
12891 spaces -= initspc; 12893 spaces -= initspc;
12892 tabs++; 12894 tabs++;
12893 } 12895 }