[haiku-development] Re: Coding guidelines

  • From: Niels Reedijk <niels.reedijk@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 8 May 2010 14:10:48 +0200

Hi Stephan,

On 8 May 2010 13:59, Stephan Assmus <superstippi@xxxxxx> wrote:
>
> On 2010-05-08 at 14:01:07 [+0200], Niels Reedijk <niels.reedijk@xxxxxxxxx>
> wrote:
>> On 8 May 2010 13:58, Niels Reedijk <niels.reedijk@xxxxxxxxx> wrote:
>> > Hi,
>> >
>> > On 8 May 2010 01:16, Jorge G. Mare <koki@xxxxxxxxxxxxx> wrote:
>> >> On 05/07/2010 03:50 PM, Markku Hyppönen wrote:
>> >>
>> >> I've been asked to change few files to follow the coding guidelines.
>> >>
>> >> Document says that indent should be set to four spaces
>> >> and that a line must not have more than 80 columns but in the first
>> >> example indents seems to be mainly 8 character and there's also couple
>> >> of lines exceeding 80 columns.
>> >>
>> >> It seems examples code is not valid, right?
>> >>
>> >>
>> >> If you are referring to the sample code under "Indenting and white space"
>> >> in...
>> >>
>> >> http://www.haiku-os.org/development/coding-guidelines
>> >>
>> >> ...then you are pointing out the same problem already reported in ticket
>> >> #5901 by Stippi.
>> >>
>> >> One of the sysadmins responded that " a \t is interpreted as 8 spaces and
>> >> this cannot be changed" and closed the ticket as invalid, but this is
>> >> incorrect.
>> >>
>> >> At least in the particular case of the Haiku website, it is possible to
>> >> change the number of spaces per tab stop, and the solution was given in
>> >> comments 2 and 3 of the same ticket:
>> >
>> > Changed that, does not work.
>>
>> Also, looking from the docs:
>> http://qbnz.com/highlighter/geshi-doc.html#setting-tab-width, Genshi
>> will replace the tabs with spaces (not sure if that would be only
>> within a div), which would also be wrong.
>>
>> Resolution is correct.
>
> I don't agree. It's highly confusing. The last resort solution would be to
> dump the <code> auto-layout and layout the coding style page code examples by
> hand.

So you would then implement a filter that finds the tabs, transforms
them into spans with a non-breakable space, tries to determine how
wide the spaces are and then makes the width times four. You might as
well ask W3C to update the HTML draft (one of the rumours I read is
that in some of the HTML5 drafts there is indeed a CSS property to
configure this floating around).

In the mean time either choose to keep the code formatted this way, or
change the tabs into four spaces. I think the current situation is
more clear (or actually, less unclear).

Anyway, feel free to reopen the ticket, but if you do and you have the
time, add all the information I gathered about possible solutions so
people don't have to dig again.

N>

Other related posts: