[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: CVS update: o_text_basic.nw



  User: cnieves 
  Date: 06/04/08 19:44:56

  Modified:    .        o_text_basic.nw
  Log:
  Fixed the overbar misinterpretation of multiple escape slashed (bug 1458681). 
  
  Thanks to Werner Hoch for reporting the bug.
  
  
  
  
  Revision  Changes    Path
  1.27      +17 -3     eda/geda/devel/libgeda/noweb/o_text_basic.nw
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: o_text_basic.nw
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/libgeda/noweb/o_text_basic.nw,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -b -r1.26 -r1.27
  --- o_text_basic.nw	3 Mar 2006 22:05:38 -0000	1.26
  +++ o_text_basic.nw	8 Apr 2006 23:44:56 -0000	1.27
  @@ -547,6 +547,7 @@
     gchar *aux_string;
     OBJECT *o_font_set;
     gunichar c=0, previous_char = 0, next_char = 0;
  +  int escapes_counter = 0;
   
     temp_list = object_list;
   
  @@ -758,8 +759,14 @@
         size_of_tab_in_coord = tab_in_chars * 
                    o_text_width(w_current, TAB_CHAR_MODEL, size/2);
   
  +      /* Count escape characters. Notice it includes the current character */
  +      if (c == '\\') {
  +	escapes_counter++;
  +      }
  +      
         /* Ignore escape characters */
  -      if ( (c == '\\') && (previous_char != '\\') )
  +      if ( ((c == '\\') && (previous_char != '\\')) ||
  +	   (c == '\\') && (escapes_counter == 1) )
   	continue;
   
         if (c != '\n' && c != '\t') {
  @@ -768,7 +775,7 @@
   	    Add it if it is the escaped escape character */
   	if ( ( (c != '\\') &&
   	       (!(previous_char == '\\' && c == '_')) ) ||
  -	     (previous_char == '\\' && c == '\\') ) {
  +	     (previous_char == '\\' && c == '\\' && (escapes_counter > 1)) ) {
   	  temp_list = o_list_copy_all(w_current, 
   				      o_font_set->font_prim_objs->next, 
   				      temp_list, NORMAL_FLAG);
  @@ -787,6 +794,13 @@
   	  o_complex_world_translate(w_current, 
   				    x_offset, y_offset, 
   				    start_of_char);
  +	  
  +	  /* Reset the escapes counter after being processed. Otherwise, 
  +	     if the next character is also a backslash, it will
  +	     be processed as if were also escaped */
  +	  if (previous_char == '\\' && c == '\\') {
  +	    escapes_counter = 0;
  +	  }
   	}
         }