lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev [PATCH 2.8.5-dev14] ladder in tables


From: Ilya Zakharevich
Subject: lynx-dev [PATCH 2.8.5-dev14] ladder in tables
Date: Tue, 4 Mar 2003 02:43:46 -0800
User-agent: Mutt/1.4i

This patch removes about 1/3 of occurences of "ladder" in tables,

   when
         cells
               go
                  like 
                       this.

[The complete fix requires much more work.]  We skip <br> and <p> at
the starts of the cells.  However, we grant the requests for new-lines
due to the style change - to allow structures like <ol> inside cells.

Enjoy,
Ilya

--- ./src/TRSTable.h~   Sat Jul  7 17:30:12 2001
+++ ./src/TRSTable.h    Tue Mar  4 01:54:00 2003
@@ -11,6 +11,7 @@ extern int Stbl_finishTABLE PARAMS((STab
 extern void Stbl_free PARAMS((STable_info *));
 extern int Stbl_addRowToTable PARAMS((STable_info *, int, int));
 extern int Stbl_addCellToTable PARAMS((STable_info *, int, int, int, int, int, 
int, int));
+extern BOOL Stbl_at_start_of_cell PARAMS((STable_info *, int, int));
 extern int Stbl_finishCellInTable PARAMS((STable_info *, int, int, int, int));
 extern int Stbl_addColInfo PARAMS((STable_info *, int, short, BOOL));
 extern int Stbl_finishColGroup PARAMS((STable_info *));
--- ./src/TRSTable.c~   Fri Feb 21 13:13:12 2003
+++ ./src/TRSTable.c    Tue Mar  4 02:05:56 2003
@@ -1534,6 +1534,31 @@ PUBLIC int Stbl_addCellToTable ARGS8(
     if (me->maxpos > /* @@@ max. line length we can accept */ MAX_STBL_POS)
        return -1;
     return 0;
+}
+
+PUBLIC BOOL Stbl_at_start_of_cell ARGS3(
+    STable_info *,     me,
+    int,               lineno,
+    int,               pos)
+{
+    STable_rowinfo *lastrow;
+    int len, xlen, icell;
+    int i;
+
+    CTRACE2(TRACE_TRST,
+           (tfp, "TRST:Stbl_at_start_of_cell(lineno=%d, pos=%d)\n",
+                 lineno, pos));
+    if (me->nrows == 0)
+       return TRUE;
+    lastrow = me->rows + (me->nrows - 1);
+    icell = lastrow->ncells - 1;
+    if (icell < 0)
+       return TRUE;
+    if (lastrow->cells[icell].cLine != lineno
+       || lastrow->cells[icell].pos != pos)
+       return FALSE;                   /* XXXX  What to do if cLine is -1? */
+    
+    return TRUE;
 }
 
 /*
--- ./src/GridText.c~   Fri Feb 21 13:00:56 2003
+++ ./src/GridText.c    Tue Mar  4 02:04:10 2003
@@ -2454,6 +2454,10 @@ PUBLIC void HText_beginAppend ARGS1(
 */
 #define new_line(text) split_line(text, 0)
 
+#define AT_START_OF_CELL(text) \
+  (text->stbl                  \
+   && Stbl_at_start_of_cell(text->stbl, text->Lines, text->last_line->size))
+
 #define DEBUG_SPLITLINE
 
 #ifdef DEBUG_SPLITLINE
@@ -3514,7 +3518,8 @@ PUBLIC void HText_appendParagraph ARGS1(
 {
     int after = text->style->spaceAfter;
     int before = text->style->spaceBefore;
-    blank_lines(text, ((after > before) ? after : before));
+    if (!AT_START_OF_CELL(text))
+       blank_lines(text, ((after > before) ? after : before));
 }
 
 
@@ -4097,6 +4102,8 @@ PUBLIC void HText_appendCharacter ARGS2(
      *  New Line.
      */
     if (ch == '\n') {
+       if (AT_START_OF_CELL(text))
+           return;
        new_line(text);
        text->in_line_1 = YES;  /* First line of new paragraph */
        /*
@@ -4130,6 +4137,8 @@ PUBLIC void HText_appendCharacter ARGS2(
      *  i.e., use the second line indenting.
      */
     if (ch == '\r') {
+       if (AT_START_OF_CELL(text))
+           return;
        new_line(text);
        text->in_line_1 = NO;
        /*

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

reply via email to

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