I'm trying to use .substring to remove the first character of a string, leaving behind whatever follows, even if that is nothing (i.e. the string had only one character).

  .substring str 1

or

  .length n2 "\*[str]
  .nr n2 -1
  .substring str 1 \n[n2]

(if n2 is omitted, it appears to default to length-1 as you might expect).

The above works as long as the string originally had at least two characters.  If it only has one, so the desired result is the empty string, it does not remove anything, leaving behind the 0th character and emitting a warning (with -w all).

This seems like a corner-case bug.

Question: Is this intentional, to remain "bug compatible" with some older roff systems?

At first glance, it seems like it would be safe to fix this because the result is currently always wrong in this case, i.e. n1 equals the length of the string (so the result should be empty).

Thoughts?

-Jim


Reply via email to