Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Word wrap patch.




 This is a patch so that messages in the info window are now wrapped.

 Also, the info window is no longer cleared (if in scroll mode) when
? or 'help is entered.

 Mark Wedel
master@cats.ucsc.edu
*** xio.c.orig	Thu Mar 11 18:03:20 1993
--- xio.c	Thu Mar 11 23:29:57 1993
***************
*** 1215,1220 ****
--- 1215,1240 ----
      draw_info(pl,cp);
      return;
    }
+   /* Lets do the word wrap for messages - MSW (master@cats.ucsc.edu) */
+   if (strlen(str)>=pl->contr->infochars) {
+ 	int i=pl->contr->infochars-1;
+ 	char buf[VERY_BIG_BUF];
+ 
+ 	/* i=last space (or ')' for armor.  Wrap armor, because
+ 	otherwise, the two sets of ()() can be about half the line */
+ 	while ((str[--i]!=' ') && (str[i]!=')') && (i!=0)) ;
+ 	/* if i==0, string has no space.  Just let it be truncated */
+ 	if (i!=0) {
+ 		i++;	/* want to keep the ')'.  This also keeps
+ 			the space, but that really doesn't matter */
+ 		strncpy(buf, str, i);
+ 		buf[i]='\0';
+ 		draw_info(pl, buf);
+ 		if (((strlen(str)-i)!=1) || (str[i]!='.'))
+ 			draw_info(pl, (str+i));
+ 		return;
+ 	}
+   }
    strncpy(pl->contr->info[pl->contr->infoline],str,pl->contr->infochars);
    XDrawImageString(pl->contr->gdisp,pl->contr->win_info,
      pl->contr->gc_info,FONTWIDTH,(pl->contr->infoline+1)*FONTHEIGHT,
***************
*** 1284,1289 ****
--- 1304,1313 ----
  
  void clear_win_info(object *op) {
    int i;
+ 
+ 	/* don't clear if in scroll mode MSW (master@cats.ucsc.edu */
+   if((op->type==PLAYER)  &&  (op->contr->scroll)) return;
+ 
    for(i=0;i<op->contr->infolines;i++) {
      (void) memset(op->contr->info[i],' ',op->contr->infochars);
      op->contr->info[i][op->contr->infochars]='\0';