Hi Anslem
Anselm R. Garbe wrote:
Hi guys,
I applied a mixture of Jukka's and Manuel's patch to hg tip.
I tried several inputs (empty lines, lines with multiple '\n', all '\n'
lines). The following patch would handle all of them correctly. Though
I 'm not sure if this is really necessary (but it remains one line of
code).
Manuel
--- readline_dwm-2.3/main.c 2006-11-26 15:10:13.000000000 +0100
+++ my_dwm-2.3/main.c 2006-11-26 15:09:43.000000000 +0100
@@ -284,8 +284,8 @@
readin = False;
break;
default:
- stext[r-(stext[r-1]=='\n'?1:0)] = '\0';
- for(p=stext+strlen(stext)-1;p>stext &&
*p!='\n';--p);
+ for(stext[r]='\0',
p=stext+strlen(stext)-1;p>=stext && *p=='\n' ;*p--='\0');
+ for(p=stext+strlen(stext)-1;p>=stext &&
*p!='\n' ;--p);
if(p>stext)
strncpy(stext, p+1,
sizeof(stext));
}