[PATCH] Re: flowing bug with ^V

Alexey Toptygin <[email protected]>
Newsgroups gmane.mail.pine.general
Message-ID <[email protected]>
On Wed, 26 Apr 2006, Alexey Toptygin wrote:

> I'm not sure how to fix this bug. I think that exporting the send.c global 
> would break standalone pico. Changing the last parameter of the exittest 
> interface to a pointer to Pmaster->allow_flowed_text so the callback can 
> change it should work. Or perhaps there needs to be an extra int* parameter 
> to the exittest interface that is set by the callback function and tested by 
> pico() before it calls cleanwhitespace()? Let me know, and I'll cook up a 
> patch.

I haven't had any feedback, but I made the attached patch anyway. Please 
review/test/comment. Thanks.

 			Alexey

_______________________________________________
Pine-info mailing list
[email protected]
http://mailman1.u.washington.edu/mailman/listinfo/pine-info
flow.patch (text/plain, 9.1 KB)
diff -urN pine4.64/pico/pico.c pine4.64-mine/pico/pico.c
--- pine4.64/pico/pico.c	2005-03-31 12:08:28.000000000 -0500
+++ pine4.64-mine/pico/pico.c	2006-04-27 16:54:03.000000000 -0400
@@ -137,6 +137,7 @@
     alt_speller   = pm->alt_spell;
     pico_all_done = 0;
     km_popped     = 0;
+    Pmaster->flow_text = Pmaster->allow_flowed_text;
 
     if(!vtinit())			/* Init Displays.      */
       return(COMP_CANCEL);
@@ -222,7 +223,8 @@
 		packheader();
 		if(Pmaster 
 		   && (Pmaster->strip_ws_before_send
-		       || Pmaster->allow_flowed_text))
+		       || (Pmaster->allow_flowed_text
+			   && Pmaster->flow_text)))
 		  cleanwhitespace();
 		c |= COMP_EXIT;
 		break;
@@ -700,7 +702,8 @@
 	if((!(Pmaster->pine_flags & MDHDRONLY) || any_header_changes())
 	   && (result = (*Pmaster->exittest)(Pmaster->headents,
 					     redraw_pico_for_callback,
-					     Pmaster->allow_flowed_text))){
+					     Pmaster->allow_flowed_text,
+					     &(Pmaster->flow_text)))){
 	    Pmaster->arm_winch_cleanup--;
 	    if(sgarbf)
 	      update();
diff -urN pine4.64/pico/pico.h pine4.64-mine/pico/pico.h
--- pine4.64/pico/pico.h	2005-03-30 17:44:40.000000000 -0500
+++ pine4.64-mine/pico/pico.h	2006-04-27 16:54:03.000000000 -0400
@@ -202,7 +202,8 @@
     /* If we had this to do over, it would probably be one giant bitmap */
     unsigned always_spell_check:1;      /* always spell-checking upon quit */
     unsigned strip_ws_before_send:1;    /* don't default strip bc of flowed */
-    unsigned allow_flowed_text:1;    /* clean text when done to keep flowed */
+    unsigned allow_flowed_text:1; /* may clean text when done to keep flowed */
+    unsigned flow_text;			/* actually do text cleaning */
     int   (*helper)();			/* Pine's help function  */
     int   (*showmsg)();			/* Pine's display_message */
     int   (*suspend)();			/* Pine's suspend */
diff -urN pine4.64/pico/random.c pine4.64-mine/pico/random.c
--- pine4.64/pico/random.c	2004-05-07 17:43:40.000000000 -0400
+++ pine4.64-mine/pico/random.c	2006-04-27 16:54:03.000000000 -0400
@@ -169,7 +169,8 @@
     /* if we are in C mode and this is a default <NL> */
     /* pico's never in C mode */
 
-    if(Pmaster && Pmaster->allow_flowed_text && curwp->w_doto
+    if(Pmaster && Pmaster->allow_flowed_text && Pmaster->flow_text
+       && curwp->w_doto
        && isspace(lgetc(curwp->w_dotp, curwp->w_doto - 1).c)
        && !(curwp->w_doto == 3
 	    && lgetc(curwp->w_dotp, 0).c == '-'
diff -urN pine4.64/pine/adrbkcmd.c pine4.64-mine/pine/adrbkcmd.c
--- pine4.64/pine/adrbkcmd.c	2005-09-27 17:27:55.000000000 -0400
+++ pine4.64-mine/pine/adrbkcmd.c	2006-04-27 16:54:03.000000000 -0400
@@ -59,7 +59,8 @@
 char          *pico_cancel_for_adrbk_edit PROTO((void (*)()));
 char          *pico_cancel_for_adrbk_take PROTO((void (*)()));
 char          *pico_cancelexit_for_adrbk PROTO((char *, void (*)()));
-char          *pico_sendexit_for_adrbk PROTO((struct headerentry *, void(*)(), int));
+char          *pico_sendexit_for_adrbk PROTO((struct headerentry *,
+					      void(*)(), int, unsigned *));
 int            process_abook_view_cmd PROTO((int, MSGNO_S *, SCROLL_S *));
 void           set_act_list_member PROTO((ACTION_LIST_S *, a_c_arg_t,
 					PerAddrBook *, PerAddrBook *, char *));
@@ -99,7 +100,8 @@
 
 char          *ldap_translate PROTO((char *, LDAP_SERV_S *));
 int            process_ldap_cmd PROTO((int, MSGNO_S *, SCROLL_S *));
-char          *pico_simpleexit PROTO((struct headerentry *, void (*)(), int));
+char          *pico_simpleexit PROTO((struct headerentry *, void (*)(),
+				      int, unsigned *));
 char          *pico_simplecancel PROTO((struct headerentry *, void (*)()));
 void           save_query_parameters PROTO((SAVED_QUERY_S *));
 SAVED_QUERY_S *copy_query_parameters PROTO((SAVED_QUERY_S *));
@@ -1596,14 +1598,18 @@
  *	 reason why the user declined.
  */      
 char *
-pico_sendexit_for_adrbk(he, redraw_pico, allow_flowed)
+pico_sendexit_for_adrbk(he, redraw_pico, allow_flowed, do_flow)
     struct headerentry *he;
     void (*redraw_pico)();
     int allow_flowed;
+    unsigned *do_flow;
 {
     char *rstr = NULL;
     void (*redraw)() = ps_global->redrawer;
 
+    /* tell pico not to flow text */
+    *do_flow = 0;
+
     ps_global->redrawer = redraw_pico;
     fix_windsize(ps_global);
     
@@ -7222,11 +7228,14 @@
 
 
 char *
-pico_simpleexit(he, redraw_pico, allow_flowed)
+pico_simpleexit(he, redraw_pico, allow_flowed, do_flow)
     struct headerentry *he;
     void (*redraw_pico)();
     int allow_flowed;
+    unsigned *do_flow;
 {
+    /* tell pico not to flow text */
+    *do_flow = 0;
     return(NULL);
 }
 
diff -urN pine4.64/pine/folder.c pine4.64-mine/pine/folder.c
--- pine4.64/pine/folder.c	2005-09-12 18:04:25.000000000 -0400
+++ pine4.64-mine/pine/folder.c	2006-04-27 16:54:03.000000000 -0400
@@ -246,7 +246,8 @@
 					 FDIR_S **, int));
 int	   folder_selector PROTO((struct pine *, FSTATE_S *,
 				  char *, CONTEXT_S **));
-char	  *exit_collection_add PROTO((struct headerentry *, void (*)(), int));
+char	  *exit_collection_add PROTO((struct headerentry *, void (*)(),
+				      int, unsigned *));
 char	  *cancel_collection_add PROTO((char *, void (*)()));
 int	   build_namespace PROTO((char *, char **, char **,
 				  BUILDER_ARG *, int *));
@@ -1421,10 +1422,11 @@
  *	 reason why the user declined.
  */      
 char *
-exit_collection_add(he, redraw_pico, allow_flowed)
+exit_collection_add(he, redraw_pico, allow_flowed, do_flow)
     struct headerentry *he;
     void (*redraw_pico)();
     int allow_flowed;
+    unsigned *do_flow;
 {
     char     prompt[256], tmp[MAILTMPLEN], tmpnodel[MAILTMPLEN], *server, *path,
 	     delim = '\0', *rstr = NULL, *p;
@@ -1432,6 +1434,9 @@
     void   (*redraw)() = ps_global->redrawer;
     NETMBX   mb;
 
+    /* tell pico not to flow text */
+    *do_flow = 0;
+
     ps_global->redrawer = redraw_pico;
     fix_windsize(ps_global);
 
diff -urN pine4.64/pine/reply.c pine4.64-mine/pine/reply.c
--- pine4.64/pine/reply.c	2005-09-12 18:04:25.000000000 -0400
+++ pine4.64-mine/pine/reply.c	2006-04-27 16:54:03.000000000 -0400
@@ -87,7 +87,8 @@
 int	 twsp_strip PROTO((long, char *, LT_INS_S **, void *));
 int	 sigdash_strip PROTO((long, char *, LT_INS_S **, void *));
 int      sigdashes_are_present PROTO((char *));
-char	*sigedit_exit_for_pico PROTO((struct headerentry *, void (*)(), int));
+char	*sigedit_exit_for_pico PROTO((struct headerentry *, void (*)(),
+				      int, unsigned *));
 char    *get_reply_data PROTO((ENVELOPE *, ACTION_S *, IndexColType,
 			       char *, size_t));
 void     get_addr_data PROTO((ENVELOPE *, IndexColType, char *, size_t));
@@ -6266,10 +6267,11 @@
  *
  */
 char *
-sigedit_exit_for_pico(he, redraw_pico, allow_flowed)
+sigedit_exit_for_pico(he, redraw_pico, allow_flowed, do_flow)
     struct headerentry *he;
     void (*redraw_pico)();
     int  allow_flowed;
+    unsigned *do_flow;
 {
     int	      rv;
     char     *rstr = NULL;
@@ -6280,6 +6282,9 @@
 	{-1, 0, NULL, NULL}
     };
 
+    /* tell pico not to flow text */
+    *do_flow = 0;
+
     ps_global->redrawer = redraw_pico;
     fix_windsize(ps_global);
 
diff -urN pine4.64/pine/send.c pine4.64-mine/pine/send.c
--- pine4.64/pine/send.c	2005-09-12 18:04:25.000000000 -0400
+++ pine4.64-mine/pine/send.c	2006-04-27 16:54:48.000000000 -0400
@@ -98,7 +98,8 @@
 void	   post_compose_filters PROTO((BODY *));
 void	   pine_send_newsgroup_name PROTO((char *, char*, size_t));
 long	   message_format_for_pico PROTO((long, int (*)(int)));
-char	  *send_exit_for_pico PROTO((struct headerentry *, void (*)(), int));
+char	  *send_exit_for_pico PROTO((struct headerentry *, void (*)(),
+				     int, unsigned *));
 int	   mime_type_for_pico PROTO((char *));
 char      *cancel_for_pico PROTO((void (*)()));
 void	   update_answered_flags PROTO((REPLY_S *));
@@ -5763,10 +5764,11 @@
 	 reason why the user declined.
 ----*/      
 char *
-send_exit_for_pico(he, redraw_pico, allow_flowed)
+send_exit_for_pico(he, redraw_pico, allow_flowed, do_flow)
     struct headerentry *he;
     void (*redraw_pico)();
     int    allow_flowed;
+    unsigned *do_flow;
 {
     int	       i, rv, c, verbose_label = 0, bg_label = 0, old_suspend;
     int        dsn_label = 0, fcc_label = 0, dsn_show, lparen;
@@ -5785,7 +5787,7 @@
     verbose_requested        = 0;
     background_requested     = 0;
     dsn_requested            = 0;
-    flowing_requested        = allow_flowed ? 1 : 0;
+    flowing_requested        = *do_flow ? 1 : 0;
     lmc.text_only            = F_ON(F_NO_FCC_ATTACH, ps_global) != 0;
 
     if(background_posting(FALSE))
@@ -5885,7 +5887,6 @@
 	opts[i].rval  = 22;
 	opts[i].name  = "^V";
 	flowing_label = i++;
-	flowing_requested = 1;
     }
 
     if(F_ON(F_NO_FCC_ATTACH, ps_global)){
@@ -6177,6 +6178,9 @@
 					       : "-Hdrs");
     }
 
+    /* let pico know if we want flowing */
+    *do_flow = flowing_requested;
+
     /* remember selection */
     if(filters && filters->index > -1)
       sending_filter_requested = ps_global->VAR_SEND_FILTER[filters->index];
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.