bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-indent] bug(?) + patch: if text string on line too long, won't brea


From: Jeff Morriss
Subject: [Bug-indent] bug(?) + patch: if text string on line too long, won't break rest of line
Date: Wed, 20 Mar 2002 17:26:04 -0500 (EST)

Hi,

Attached is a patch which fixes indent's breaking of lines when there is a 
text very long text string (or similar un-line-breakable thing) which goes 
past max_col columns.

E.g,. take this code segment:

int
main(int argv, char **argc)
{

        printf("This %s line %s just %s has %s a %s lot %s of %s args 
%s\n",
                "1", "2", "3", "4", "5", "6", "7", "8");

        printf("this line %s %s too long.  %s also takes a lot of %s and 
%d arguments\n",
                "is", "really", "It", "foo", 21);

        (void) fprintf (stderr, "%s: YOUR_HOME not foo found in the 
environment\n",
                        argv[0]);

}


(NOTE that my mailer broke up the text strings;  they should NOT be broken 
up so but should rather go past 80 columns.)


When run through 'indent' as such:

mozart [~/Projects/indent-2.2.7/]> src/indent -bad -bli0 -cli0 -cbi0 -i8 
-ut foo.c -o foo.out


it will NOT put the format arguments on a separate line in the *second*
'printf()' (in fact it will put the whole 'printf()' on a single line).  
The other 'printf()'s are there as "other cases" to make sure I didn't 
break it too horribly.

The below patch fixes this by changing where the test for going past
'max_col' is.  I've done limited testing (and my knowledge of 'indent' is
fairly low--I only started using it this afternoon) but it seems to work
well.

Any thoughts?

Regards,
-Jeff

-- 
Robert "Jeff"rey Morriss          Senior Support Engineer (by day)
address@hidden                 Ulticom (Mount Laurel, NJ;  USA)
http://www.pobox.com/~morriss     #include<std/disclaimer.h>
PGP key on public key servers;    Linux: the choice of a GNU generation

Attachment: io.c.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]