bugGNU Gengetopt - Bugs: bug #35573, Minor formatting error when...

 
 

bug #35573: Minor formatting error when wrapping on a double-space

Submitted by:  Tim Marston <edam>
Submitted on:  Mon 20 Feb 2012 10:47:56 PM UTC  
 
Category: NoneSeverity: 2 - Minor
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Tim Marston <edam>
Originator Name: Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 20 Feb 2012 10:47:56 PM UTC, original submission:

In wrap_cstr(), when line wrapping occurs at a point in the string where there are two spaces together, the extra space causes the next line to get indented by an extra space.

You can see this occurring gengetopt's own --help text. In the description of the --unamed-opts argument, the second line is indented by an extra three spaces, rather than the usual two.

I've attached a patch that fixes this issue. It works as follows:

- preceding spaces are included in next_word

- leading spaces are trimmed from next_word when wrapping is done

Additionally, the patch makes two other changes:

- the `if (*out_buf)` test at the start of the loop was removed because, unless I missed something, it will always succeed!

- the two lines that, unless newlines were detected, always added a character to the output have been removed. It is not always ideal to add at least one character to the output: In the scenario where the next character is a space and you will be wrapping the line, that space will be outputted before the '\n'. For example, "...word word \n<indent>word...". Since preceding spaces are now included in next_word, removing this should be ok.

Tim Marston <edam>
Project MemberIn charge of this item.

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #25095:  patch added by edam (2KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by edam (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 11 Jul 2012 06:41:25 PM UTCedamSeverity3 - Normal=>2 - Minor
      StatusNone=>Fixed
      Assigned toNone=>edam
      Open/ClosedOpen=>Closed
    Mon 20 Feb 2012 10:47:56 PM UTCedamAttached File-=>Added patch, #25095

    Back to the top


    Powered by Savane 3.1-cleanup1