lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev [PATCH 2.8.5-dev15] table cleanup update


From: Ilya Zakharevich
Subject: lynx-dev [PATCH 2.8.5-dev15] table cleanup update
Date: Thu, 11 Sep 2003 09:02:34 -0700
User-agent: Mutt/1.4i

This patch addresses 2 out of the known 4 issues with the latest
"correct table layout" code.  One of them is cosmetic (a line in a
multi-line cell may be shown in a wrong vertical position); another
one was a (quite rare) segfault.

The two remaining issues are cosmetic:

  whitespace optimization (HTML without whitespace near <tr> etc tags
  may have cells which are NOT separated by whitespace); and

  horizontal positioning of the table as a whole (the code to get the
  width of the table is apparently wrong; I know the location of the
  bug up to 20 LOC ;-], but did not investigate it more).

Enjoy,
Ilya

--- ./src/TRSTable.c~   Sat Jun 21 10:43:30 2003
+++ ./src/TRSTable.c    Tue Aug  5 07:04:30 2003
@@ -1660,6 +1665,8 @@ PUBLIC int Stbl_start_of_last_cell ARGS2
     if (me->nrows == 0)
        return -1;
     lastrow = me->rows + (me->nrows - 1);
+    if (lastrow->ended != ROW_not_ended)
+       return -1;                      /* E.g., may be processing </tr> */
     icell = lastrow->ncells - 1;
     if (icell >= 0 && lastrow->cells[icell].cLine == lineno)
        return lastrow->cells[icell].pos;
--- ./src/GridText.c~   Wed Jun 25 10:17:04 2003
+++ ./src/GridText.c    Tue Aug  5 07:46:04 2003
@@ -4428,14 +4428,15 @@ check_WrapSource:
        limit = (WRAP_COLS(text) - 1);
     }
 
-    if (actual >= limit && flush_cell && split_line_at_cellstart(text,actual)) 
{
+    if ( actual >= limit + (ch == ' ') && flush_cell
+         && split_line_at_cellstart(text,actual) ) {
        flush_cell = 0;
        line = text->last_line;
        /* Do not change style: essentially, no change was done. */
        goto do_newline;
     }
     
-    if (actual >= limit) {
+    if (actual >= limit + (ch == ' ')) {
 
        if (style->wordWrap && HTOutputFormat != WWW_SOURCE) {
 #ifdef EXP_JUSTIFY_ELTS
@@ -4870,36 +4875,38 @@ PRIVATE int HText_insertBlanksInStblLine
                int opos = 0, npos = do_unsplit;
 
                /* Redo insertion with larger offset */
                me->last_anchor_before_stbl = a_prev_before;
                mod_line = 
                    insert_blanks_in_line(line, lineno - deleted, me,
                                          &me->last_anchor_before_stbl 
/*updates++*/,
                                          1, &opos, &npos);
-               if (line == me->last_line) {
-                   me->last_line = mod_line;
-               } else {
-                   added_chars_before += (mod_line->size - line->size);
-               }
-               line->prev->next = mod_line;
-               line->next->prev = mod_line;
-               lines_changed++;
-               if (line == first_line)
-                   first_line = mod_line;
-               line = mod_line;
+               if (mod_line) {
+                   if (line == me->last_line) {
+                       me->last_line = mod_line;
+                   } else {
+                       added_chars_before += (mod_line->size - line->size);
+                   }
+                   line->prev->next = mod_line;
+                   line->next->prev = mod_line;
+                   lines_changed++;
+                   if (line == first_line)
+                       first_line = mod_line;
+                   line = mod_line;
 #ifdef DISP_PARTIAL
                /*
                 *  Make sure modified lines get fully re-displayed after
                 *  loading with partial display is done.
                 */
-               if (me->first_lineno_last_disp_partial >= 0) {
-                   if (me->first_lineno_last_disp_partial >= lineno) {
+                   if (me->first_lineno_last_disp_partial >= 0) {
+                     if (me->first_lineno_last_disp_partial >= lineno) {
                        me->first_lineno_last_disp_partial =
                            me->last_lineno_last_disp_partial = -1;
-                   } else if (me->last_lineno_last_disp_partial >= lineno) {
+                     } else if (me->last_lineno_last_disp_partial >= lineno) {
                        me->last_lineno_last_disp_partial = lineno - 1;
+                     }
                    }
-               }
 #endif
+               }
            }
        }
        {

; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

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