groff
[Top][All Lists]
Advanced

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

Re: [Groff] indentation with macro ends


From: Bernd Warken
Subject: Re: [Groff] indentation with macro ends
Date: Mon, 22 Oct 2001 14:53:45 +0200
User-agent: Mutt/1.2.5i

On Sun, Oct 21, 2001 at 01:12:57AM +0200, Bernd Warken wrote:
> groff allows to indent every request/macro call as long as the leading
> . stays at position 1 of the line.  Morevover, it is possible to define
> a macro within a macro definition (it takes the arguments from the
> parent definition).  Unfortunately the ending tag cannot be indented.
> 
The following patch fixes the indentation of ending tags.  It is
relative to <groff_source>/src/roff/troff

--- input.cc.orig       Sun Oct 21 00:37:22 2001
+++ input.cc    Mon Oct 22 14:45:16 2001
@@ -3797,11 +3797,17 @@
       const char *s = term.contents();
       int d = 0;
       // see if it matches term
-      int i;
-      for (i = 0; s[i] != 0; i++) {
-       d = get_copy(&n);
-       if ((unsigned char)s[i] != d)
-         break;
+      int i = 0;
+      if (s[0] != 0) {
+       while( (d = get_copy(&n)) == ' ' )
+         {}
+       if ( (unsigned char)s[0] == d ) {
+         for (i = 1; s[i] != 0; i++) {
+           d = get_copy(&n);
+           if ((unsigned char)s[i] != d)
+             break;
+         }
+       }
       }
       if (s[i] == 0
          && ((i == 2 && compatible_flag)

Good luck

Bernd Warken


reply via email to

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