Hi Bram and List,

I was refactoring the 'backspace' option of implementation.

The following patch was incomplete.
(It's my first created and contributed patch! Four years ago...)

Patch 7.3.354
Problem:    ":set backspace+=eol" doesn't work when 'backspace' has a 
            backwards compatible value of 2.
Solution:   Convert the number to a string. (Hirohito Higashi)
Files:      src/option.c
https://groups.google.com/d/topic/vim_dev/F3uFnrdYO3g/discussion


A new patch has unified 'p_bs' variable handling to a string. So, remove the 
numerical reference process.

Please check this.
--
Best regards,
Hirohito Higashi (a.k.a h_east)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/option.c b/src/option.c
index 0c38de6..71f9610 100644
--- a/src/option.c
+++ b/src/option.c
@@ -4706,25 +4706,28 @@ do_set(arg, opt_flags)
 			     * adding, prepending and removing string.
 			     */
 			    else if (varp == (char_u *)&p_bs
-					 && VIM_ISDIGIT(**(char_u **)varp))
+					 && VIM_ISDIGIT(*arg))
 			    {
-				i = getdigits((char_u **)varp);
-				switch (i)
+				if (*arg > '2' || arg[1] != NUL)
 				{
-				    case 0:
-					*(char_u **)varp = empty_option;
-					break;
-				    case 1:
-					*(char_u **)varp = vim_strsave(
-						      (char_u *)"indent,eol");
-					break;
-				    case 2:
-					*(char_u **)varp = vim_strsave(
-						(char_u *)"indent,eol,start");
-					break;
+				    errmsg = e_invarg;
+				    goto skip;
+				}
+				*errbuf = NUL;
+				i = getdigits(&arg);
+				if (i >= 1)
+				{
+				    STRCAT(errbuf, p_bs_values[0]);
+				    STRCAT(errbuf, ",");
+				    STRCAT(errbuf, p_bs_values[1]);
+				}
+				if (i == 2)
+				{
+				    STRCAT(errbuf, ",");
+				    STRCAT(errbuf, p_bs_values[2]);
 				}
-				vim_free(oldval);
-				oldval = *(char_u **)varp;
+				save_arg = arg;
+				arg = errbuf;
 			    }
 			    /*
 			     * Convert 'whichwrap' number to string, for
@@ -7041,12 +7044,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
     /* 'backspace' */
     else if (varp == &p_bs)
     {
-	if (VIM_ISDIGIT(*p_bs))
-	{
-	    if (*p_bs >'2' || p_bs[1] != NUL)
-		errmsg = e_invarg;
-	}
-	else if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK)
+	if (check_opt_strings(p_bs, p_bs_values, TRUE) != OK)
 	    errmsg = e_invarg;
     }
     else if (varp == &p_bo)
@@ -12096,12 +12094,6 @@ check_opt_wim()
 can_bs(what)
     int		what;	    /* BS_INDENT, BS_EOL or BS_START */
 {
-    switch (*p_bs)
-    {
-	case '2':	return TRUE;
-	case '1':	return (what != BS_START);
-	case '0':	return FALSE;
-    }
     return vim_strchr(p_bs, what) != NULL;
 }
 

Raspunde prin e-mail lui