To: vim_dev@googlegroups.com Subject: Patch 8.1.0114 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0114 Problem: Confusing variable name. Solution: Rename new_ts to new_vts_array. Change zero to NULL. Files: src/ex_cmds.c, src/option.c *** ../vim-8.1.0113/src/ex_cmds.c 2018-06-24 16:53:31.649909925 +0200 --- src/ex_cmds.c 2018-06-24 22:04:12.929793169 +0200 *************** *** 678,684 **** char_u *new_line = (char_u *)1; /* init to non-NULL */ int did_undo; /* called u_save for current line */ #ifdef FEAT_VARTABS ! int *new_ts = 0; char_u *new_ts_str; /* string value of tab argument */ #else int temp; --- 678,684 ---- char_u *new_line = (char_u *)1; /* init to non-NULL */ int did_undo; /* called u_save for current line */ #ifdef FEAT_VARTABS ! int *new_vts_array = NULL; char_u *new_ts_str; /* string value of tab argument */ #else int temp; *************** *** 693,708 **** #ifdef FEAT_VARTABS new_ts_str = eap->arg; ! if (!tabstop_set(eap->arg, &new_ts)) return; while (vim_isdigit(*(eap->arg)) || *(eap->arg) == ',') ++(eap->arg); ! // This ensures that either new_ts and new_ts_str are freshly allocated, ! // or new_ts points to an existing array and new_ts_str is null. ! if (new_ts == 0) { ! new_ts = curbuf->b_p_vts_array; new_ts_str = NULL; } else --- 693,709 ---- #ifdef FEAT_VARTABS new_ts_str = eap->arg; ! if (!tabstop_set(eap->arg, &new_vts_array)) return; while (vim_isdigit(*(eap->arg)) || *(eap->arg) == ',') ++(eap->arg); ! // This ensures that either new_vts_array and new_ts_str are freshly ! // allocated, or new_vts_array points to an existing array and new_ts_str ! // is null. ! if (new_vts_array == NULL) { ! new_vts_array = curbuf->b_p_vts_array; new_ts_str = NULL; } else *************** *** 753,761 **** int t, s; tabstop_fromto(start_vcol, vcol, ! tabstop_count(new_ts)? 0: curbuf->b_p_ts, ! new_ts, ! &t, &s); num_tabs = t; num_spaces = s; #else --- 754,760 ---- int t, s; tabstop_fromto(start_vcol, vcol, ! curbuf->b_p_ts, new_vts_array, &t, &s); num_tabs = t; num_spaces = s; #else *************** *** 829,839 **** // If a single value was given then it can be considered equal to // either the value of 'tabstop' or the value of 'vartabstop'. if (tabstop_count(curbuf->b_p_vts_array) == 0 ! && tabstop_count(new_ts) == 1 ! && curbuf->b_p_ts == tabstop_first(new_ts)) ; /* not changed */ else if (tabstop_count(curbuf->b_p_vts_array) > 0 ! && tabstop_eq(curbuf->b_p_vts_array, new_ts)) ; /* not changed */ else redraw_curbuf_later(NOT_VALID); --- 828,838 ---- // If a single value was given then it can be considered equal to // either the value of 'tabstop' or the value of 'vartabstop'. if (tabstop_count(curbuf->b_p_vts_array) == 0 ! && tabstop_count(new_vts_array) == 1 ! && curbuf->b_p_ts == tabstop_first(new_vts_array)) ; /* not changed */ else if (tabstop_count(curbuf->b_p_vts_array) > 0 ! && tabstop_eq(curbuf->b_p_vts_array, new_vts_array)) ; /* not changed */ else redraw_curbuf_later(NOT_VALID); *************** *** 853,872 **** // than one tabstop then update 'vartabstop'. int *old_vts_ary = curbuf->b_p_vts_array; ! if (tabstop_count(old_vts_ary) > 0 || tabstop_count(new_ts) > 1) { set_string_option_direct((char_u *)"vts", -1, new_ts_str, OPT_FREE|OPT_LOCAL, 0); vim_free(new_ts_str); ! curbuf->b_p_vts_array = new_ts; vim_free(old_vts_ary); } else { // 'vartabstop' wasn't in use and a single value was given to // retab then update 'tabstop'. ! curbuf->b_p_ts = tabstop_first(new_ts); ! vim_free(new_ts); } } #else --- 852,871 ---- // than one tabstop then update 'vartabstop'. int *old_vts_ary = curbuf->b_p_vts_array; ! if (tabstop_count(old_vts_ary) > 0 || tabstop_count(new_vts_array) > 1) { set_string_option_direct((char_u *)"vts", -1, new_ts_str, OPT_FREE|OPT_LOCAL, 0); vim_free(new_ts_str); ! curbuf->b_p_vts_array = new_vts_array; vim_free(old_vts_ary); } else { // 'vartabstop' wasn't in use and a single value was given to // retab then update 'tabstop'. ! curbuf->b_p_ts = tabstop_first(new_vts_array); ! vim_free(new_vts_array); } } #else *** ../vim-8.1.0113/src/option.c 2018-06-24 15:14:02.224061917 +0200 --- src/option.c 2018-06-24 22:03:45.413912296 +0200 *************** *** 12844,12850 **** int t; int excess; ! if (vts == 0 || vts[0] == 0) return (col / ts) * ts; tabcount = vts[0]; --- 12844,12850 ---- int t; int excess; ! if (vts == NULL || vts[0] == 0) return (col / ts) * ts; tabcount = vts[0]; *************** *** 12878,12887 **** int tabcount; int t; ! if (vts == 0 || vts[0] == 0) { int tabs = 0; int initspc = ts - (start_col % ts); if (spaces >= initspc) { spaces -= initspc; --- 12878,12888 ---- int tabcount; int t; ! if (vts == NULL || vts[0] == 0) { int tabs = 0; int initspc = ts - (start_col % ts); + if (spaces >= initspc) { spaces -= initspc; *** ../vim-8.1.0113/src/version.c 2018-06-24 19:23:59.989047923 +0200 --- src/version.c 2018-06-24 22:05:27.937462580 +0200 *************** *** 791,792 **** --- 791,794 ---- { /* Add new patch number below this line */ + /**/ + 114, /**/ -- hundred-and-one symptoms of being an internet addict: 109. You actually read -- and enjoy -- lists like this. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///