jeudi 28 juillet 2016

Break long lines that end with comment

Given the file alfa.c:

#include <stdio.h>
int main() {
  int bravo = 1;
  printf("charlie delta echo foxtrot golf hotel india juliet kilo lima %dn", bravo);
}

I can format it using GNU Indent and the long line is correctly broken:

$ indent -st alfa.c
#include <stdio.h>
int
main ()
{
  int bravo = 1;
  printf ("charlie delta echo foxtrot golf hotel india juliet kilo lima %dn",
          bravo);
}

However if I add a comment, the line is no longer broken:

$ indent -st alfa.c
#include <stdio.h>
int
main ()
{
  int bravo = 1;
  printf ("charlie delta echo foxtrot golf hotel india juliet kilo lima %dn", bravo);  // this is a comment
}

How can I break long lines, even if they end with a comment?

Aucun commentaire:

Enregistrer un commentaire