Mercurial > vim
comparison src/ex_cmds.c @ 14194:6fbb8dfb3389 v8.1.0114
patch 8.1.0114: confusing variable name
commit https://github.com/vim/vim/commit/0119a59ffdfb21cf1c0a56e7ed6105e875150163
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 24 23:53:28 2018 +0200
patch 8.1.0114: confusing variable name
Problem: Confusing variable name.
Solution: Rename new_ts to new_vts_array. Change zero to NULL.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 25 Jun 2018 00:00:07 +0200 |
parents | 20468fb49f9b |
children | f2ab259ef88a |
comparison
equal
deleted
inserted
replaced
14193:c460506890ba | 14194:6fbb8dfb3389 |
---|---|
676 long old_len; | 676 long old_len; |
677 char_u *ptr; | 677 char_u *ptr; |
678 char_u *new_line = (char_u *)1; /* init to non-NULL */ | 678 char_u *new_line = (char_u *)1; /* init to non-NULL */ |
679 int did_undo; /* called u_save for current line */ | 679 int did_undo; /* called u_save for current line */ |
680 #ifdef FEAT_VARTABS | 680 #ifdef FEAT_VARTABS |
681 int *new_ts = 0; | 681 int *new_vts_array = NULL; |
682 char_u *new_ts_str; /* string value of tab argument */ | 682 char_u *new_ts_str; /* string value of tab argument */ |
683 #else | 683 #else |
684 int temp; | 684 int temp; |
685 int new_ts; | 685 int new_ts; |
686 #endif | 686 #endif |
691 save_list = curwin->w_p_list; | 691 save_list = curwin->w_p_list; |
692 curwin->w_p_list = 0; /* don't want list mode here */ | 692 curwin->w_p_list = 0; /* don't want list mode here */ |
693 | 693 |
694 #ifdef FEAT_VARTABS | 694 #ifdef FEAT_VARTABS |
695 new_ts_str = eap->arg; | 695 new_ts_str = eap->arg; |
696 if (!tabstop_set(eap->arg, &new_ts)) | 696 if (!tabstop_set(eap->arg, &new_vts_array)) |
697 return; | 697 return; |
698 while (vim_isdigit(*(eap->arg)) || *(eap->arg) == ',') | 698 while (vim_isdigit(*(eap->arg)) || *(eap->arg) == ',') |
699 ++(eap->arg); | 699 ++(eap->arg); |
700 | 700 |
701 // This ensures that either new_ts and new_ts_str are freshly allocated, | 701 // This ensures that either new_vts_array and new_ts_str are freshly |
702 // or new_ts points to an existing array and new_ts_str is null. | 702 // allocated, or new_vts_array points to an existing array and new_ts_str |
703 if (new_ts == 0) | 703 // is null. |
704 { | 704 if (new_vts_array == NULL) |
705 new_ts = curbuf->b_p_vts_array; | 705 { |
706 new_vts_array = curbuf->b_p_vts_array; | |
706 new_ts_str = NULL; | 707 new_ts_str = NULL; |
707 } | 708 } |
708 else | 709 else |
709 new_ts_str = vim_strnsave(new_ts_str, eap->arg - new_ts_str); | 710 new_ts_str = vim_strnsave(new_ts_str, eap->arg - new_ts_str); |
710 #else | 711 #else |
751 { | 752 { |
752 #ifdef FEAT_VARTABS | 753 #ifdef FEAT_VARTABS |
753 int t, s; | 754 int t, s; |
754 | 755 |
755 tabstop_fromto(start_vcol, vcol, | 756 tabstop_fromto(start_vcol, vcol, |
756 tabstop_count(new_ts)? 0: curbuf->b_p_ts, | 757 curbuf->b_p_ts, new_vts_array, &t, &s); |
757 new_ts, | |
758 &t, &s); | |
759 num_tabs = t; | 758 num_tabs = t; |
760 num_spaces = s; | 759 num_spaces = s; |
761 #else | 760 #else |
762 temp = new_ts - (start_vcol % new_ts); | 761 temp = new_ts - (start_vcol % new_ts); |
763 if (num_spaces >= temp) | 762 if (num_spaces >= temp) |
827 | 826 |
828 #ifdef FEAT_VARTABS | 827 #ifdef FEAT_VARTABS |
829 // If a single value was given then it can be considered equal to | 828 // If a single value was given then it can be considered equal to |
830 // either the value of 'tabstop' or the value of 'vartabstop'. | 829 // either the value of 'tabstop' or the value of 'vartabstop'. |
831 if (tabstop_count(curbuf->b_p_vts_array) == 0 | 830 if (tabstop_count(curbuf->b_p_vts_array) == 0 |
832 && tabstop_count(new_ts) == 1 | 831 && tabstop_count(new_vts_array) == 1 |
833 && curbuf->b_p_ts == tabstop_first(new_ts)) | 832 && curbuf->b_p_ts == tabstop_first(new_vts_array)) |
834 ; /* not changed */ | 833 ; /* not changed */ |
835 else if (tabstop_count(curbuf->b_p_vts_array) > 0 | 834 else if (tabstop_count(curbuf->b_p_vts_array) > 0 |
836 && tabstop_eq(curbuf->b_p_vts_array, new_ts)) | 835 && tabstop_eq(curbuf->b_p_vts_array, new_vts_array)) |
837 ; /* not changed */ | 836 ; /* not changed */ |
838 else | 837 else |
839 redraw_curbuf_later(NOT_VALID); | 838 redraw_curbuf_later(NOT_VALID); |
840 #else | 839 #else |
841 if (curbuf->b_p_ts != new_ts) | 840 if (curbuf->b_p_ts != new_ts) |
851 { | 850 { |
852 // If 'vartabstop' is in use or if the value given to retab has more | 851 // If 'vartabstop' is in use or if the value given to retab has more |
853 // than one tabstop then update 'vartabstop'. | 852 // than one tabstop then update 'vartabstop'. |
854 int *old_vts_ary = curbuf->b_p_vts_array; | 853 int *old_vts_ary = curbuf->b_p_vts_array; |
855 | 854 |
856 if (tabstop_count(old_vts_ary) > 0 || tabstop_count(new_ts) > 1) | 855 if (tabstop_count(old_vts_ary) > 0 || tabstop_count(new_vts_array) > 1) |
857 { | 856 { |
858 set_string_option_direct((char_u *)"vts", -1, new_ts_str, | 857 set_string_option_direct((char_u *)"vts", -1, new_ts_str, |
859 OPT_FREE|OPT_LOCAL, 0); | 858 OPT_FREE|OPT_LOCAL, 0); |
860 vim_free(new_ts_str); | 859 vim_free(new_ts_str); |
861 curbuf->b_p_vts_array = new_ts; | 860 curbuf->b_p_vts_array = new_vts_array; |
862 vim_free(old_vts_ary); | 861 vim_free(old_vts_ary); |
863 } | 862 } |
864 else | 863 else |
865 { | 864 { |
866 // 'vartabstop' wasn't in use and a single value was given to | 865 // 'vartabstop' wasn't in use and a single value was given to |
867 // retab then update 'tabstop'. | 866 // retab then update 'tabstop'. |
868 curbuf->b_p_ts = tabstop_first(new_ts); | 867 curbuf->b_p_ts = tabstop_first(new_vts_array); |
869 vim_free(new_ts); | 868 vim_free(new_vts_array); |
870 } | 869 } |
871 } | 870 } |
872 #else | 871 #else |
873 curbuf->b_p_ts = new_ts; | 872 curbuf->b_p_ts = new_ts; |
874 #endif | 873 #endif |