lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev small patch to fix justification


From: Vlad Harchev
Subject: lynx-dev small patch to fix justification
Date: Sun, 1 Aug 1999 12:17:41 +0500 (SAMST)

 
 Currently justification is disabled or enabled by html element. It's disabled
for a few elements. In normal circumstances all the content of those elements
starts from new line (FORM, CENTER, H1, etc). But in tables, this is not true
- the form element can be placed in form on line with normal text. For such
lines, justification was enabled in begining of the line, and disabled at the
end. Since in lines for which justification was enabled LY_NONBREAK_SPACE is
not converted to ' ' till justification is not done, in original dev5 lynxes
such LY_NONBREAK_SPACE were left raw in HText. This patch adds logic that
prevents such things from happening (raw LY_NONBREAK_SPACE will be
substituted with ' ').

 Example: go to 
         www.redhat.com
 Look at the 1st input (right after "Join Our Team") - there is '^A' drawn -
this is raw LY_NONBREAK_SPACE.

 Best regards,
  -Vlad

--- GridText.c-was      Sat Jul 31 04:38:14 1999
+++ GridText.c  Sun Aug  1 12:06:49 1999
@@ -298,6 +298,7 @@
     it tells to which position j=justified_text_map[i] in justified text
     i-th character is mapped - it's used for anchor positions fixup and for
     color style's positions adjustment. */
+static BOOL have_raw_nbsps = FALSE;    
 
 PUBLIC void ht_justify_cleanup NOARGS
 {
@@ -313,6 +314,7 @@
     last_anchor_of_previous_line = NULL;
     this_line_was_splitted = FALSE;
     in_DT = FALSE;
+    have_raw_nbsps = FALSE;
 }
 
 PUBLIC void mark_justify_start_position ARGS1(void*,text)
@@ -2760,9 +2762,22 @@
            for (p=previous->data;*p;++p)
                if (*p == HT_NON_BREAK_SPACE)
                    *p = ' ';
-       }
-
-       /* HT_NON_BREAK_SPACEs were subsituted with spaces in
+       } else if (have_raw_nbsps) {
+               /* this is very rare case, that can happen in forms placed in 
+                  table cells*/
+               int i;
+       
+               for (i=0;i< previous->size;++i)
+                   if (previous->data[i] == HT_NON_BREAK_SPACE)
+                       previous->data[i] = ' ';
+               
+               /*next line won't be justified, so subsitute nbsps in it too */
+               for (i=0;i< line->size;++i)
+                   if (line->data[i] == HT_NON_BREAK_SPACE)
+                       line->data[i] = ' ';
+       };
+    
+       /* else HT_NON_BREAK_SPACEs were subsituted with spaces in
           HText_appendCharacter */
        {
            /* keep maintaining 'last_anchor_of_previous_line' */
@@ -2778,12 +2793,12 @@
                for (; a2 && a2->line_num <= text->Lines-1;
                    last_anchor_of_previous_line = a2, a2 = a2->next);
        }
-    }
-
+    };
        /* cleanup */
     can_justify_this_line = TRUE;
     justify_start_position = 0;
     this_line_was_splitted = FALSE;
+    have_raw_nbsps = FALSE;
 #endif
 } /* split_line */
 
@@ -3434,6 +3449,11 @@
 #endif
      )
        ch = ' ';
+#ifdef EXP_JUSTIFY_ELTS     
+    else
+        have_raw_nbsps = TRUE;
+#endif
+    
     /* we leave raw HT_NON_BREAK_SPACE otherwise (we'll substitute it later) */
 
     if (ch & 0x80)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]