[elinks-dev] Re: elinks - witekfl: Smart config is even smarter now. '\n' ...

Witold Filipczyk witekfl at poczta.gazeta.pl
Sun Oct 26 00:33:54 PDT 2003


On Sat, Oct 25, 2003 at 12:19:36PM +0200, Petr Baudis wrote:
> Dear diary, on Sat, Oct 25, 2003 at 06:46:03AM CEST, I got a letter,
> where cvs at pasky.ji.cz told me, that...
> > This is an automated notification of a change to the ELinks CVS tree.
> > 
> > Author: witekfl
> > Module: elinks
> >    Tag: <TRUNK>
> >   Date: Sat Oct 25 04:46:03 2003 GMT
> > 
> > ---- Log message:
> > 
> > Smart config is even smarter now. '\n' could be removed from descriptions.
> > 
> > 
> > 
> > ---- Files affected:
> > 
> > elinks/src/config:
> >    conf.c (1.98 -> 1.99) 
> >     http://cvsweb.elinks.or.cz/cvsweb.cgi/elinks/src/config/conf.c.diff?r1=1.98&r2=1.99&f=u
> > 
> > 
> > ---- Diffs:
> > 
> > Index: elinks/src/config/conf.c
> > diff -u elinks/src/config/conf.c:1.98 elinks/src/config/conf.c:1.99
> > --- elinks/src/config/conf.c:1.98	Fri Oct 24 13:41:42 2003
> > +++ elinks/src/config/conf.c	Sat Oct 25 06:45:58 2003
> > @@ -479,7 +479,6 @@
> >  		       int action, int i18n)
> >  {
> >  	unsigned char *desc_i18n;
> > -	int i, l;
> >  
> >  	/* When we're OPT_TREE, we won't get called with action 2 anyway and
> >  	 * we want to pop out a comment. */
> > @@ -515,22 +514,44 @@
> >  				break;
> >  
> >  			desc_i18n = conf_i18n(option->desc, i18n);
> > -			l = strlen(desc_i18n);
> >  
> >  			if (depth)
> >  				add_xchar_to_string(string, ' ', depth * indentation);
> >  			add_to_string(string, "# ");
> > -
> > -			for (i = 0; i < l; i++) {
> > -				add_char_to_string(string, desc_i18n[i]);
> > -				if (desc_i18n[i] == '\n') {
> > -					if (depth)
> > -						add_xchar_to_string(string, ' ',
> > -								    depth * indentation);
> > -					add_to_string(string, "# ");
> > +			{
> > +				unsigned char *i = desc_i18n;
> > +				unsigned char *j = i;
> > +				unsigned char *last_space = NULL;
> > +				int config_width = 80;
> > +				int n = depth * indentation + 2;
> > +				
> > +				for (; *i; i++, n++) {
> > +					if (*i == '\n') {
> > +						add_bytes_to_string(string, j, i - j + 1);
> > +						if (depth)
> > +							add_xchar_to_string(string, ' ', depth * indentation);
> > +						add_to_string(string, "# ");
> > +						j = i + 1;
> > +						n = depth * indentation + 1;
> > +						last_space = NULL;
> > +						continue;
> > +					}
> > +
> > +					if (*i == ' ') last_space = i;
> > +
> > +					if (n >= config_width && last_space) {
> > +						add_bytes_to_string(string, j, last_space - j);
> > +						add_char_to_string(string, '\n');
> > +						if (depth)
> > +							add_xchar_to_string(string, ' ', depth * indentation);
> > +						add_to_string(string, "# ");
> > +						j = last_space + 1;
> > +						n = depth * indentation + 1 + i - last_space;
> > +						last_space = NULL;
> > +					}
> >  				}
> > +				add_to_string(string, j);
> >  			}
> > -
> >  			add_char_to_string(string, '\n');
> >  			break;
> >  
> 

OK. I'm listening.


-- 
Witold Filipczyk tohu-bohu
<witekfl at poczta.gazeta.pl>



More information about the elinks-dev mailing list