Re: [dev] [st] strange behaviour with nano

From: Roberto E. Vargas Caballero <>
Date: Mon, 25 Feb 2013 09:45:08 +0100

On Mon, Feb 25, 2013 at 04:44:11AM +0400, Alexander Sedov wrote:
> Commenting on this even further:
> - tested whether st rightfully extracts selection contents. It does, as
> debug output told me, so the problem is in nano.

Usually we try don't add code for fixing bugs in others programs. If you
find such case, then it is more logical you send the patch to the bugsy
application, in this case alpine.

> Conclusion: as it is unheard of an application which can't handle carriage
> returns, but some buggy applications cannot handle linefeeds well due to
> mysterious and arcane reasons, and because workaround costs three lines of
> code, I would propose this patch to be applied to upstream.

+ char *p;
+ for(p = memchr(s, '\n', n); p != NULL; p = memchr(p, '\n', s + n - p))
+ *p = '\r';

I would prefer something like:

        char *p = s, *q = s + n;

        while(p = memchr(p, '\n', q - p))
                *p = '\r';

Best regards,
Received on Mon Feb 25 2013 - 09:45:08 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 25 2013 - 09:48:05 CET