lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev New <BR> collapsing patch


From: David Henderson
Subject: lynx-dev New <BR> collapsing patch
Date: Fri, 14 Aug 1998 13:07:56 -0500 (CDT)

This appears to work (from dev.20), and it looks like it doesn't really
complicate things any.

It goes on the assumption that COLLAPSE_BR_TAGS=TRUE means use the new
collapsing technique, and that COLLAPSE_BR_TAGS=FALSE means add a \r
for every <BR>, regardless of the number of them encountered.  If someone
wants to take this and make it a troggle (like comment parsing: correct,
minimal, or historic), that would be even better.

*** HTML.c.orig Fri Aug 14 11:09:02 1998
--- HTML.c      Fri Aug 14 11:11:32 1998
***************
*** 1532,1539 ****
      case HTML_BR:
        UPDATE_STYLE;
        CHECK_ID(HTML_GEN_ID);
        if ((LYCollapseBRs == FALSE) ||
!           HText_LastLineSize(me->text, FALSE)) {
            HText_setLastChar(me->text, ' ');  /* absorb white space */
            HText_appendCharacter(me->text, '\r');
        }
--- 1532,1546 ----
      case HTML_BR:
        UPDATE_STYLE;
        CHECK_ID(HTML_GEN_ID);
+         /* Add a \r (new line) if one of these three scenarios are true:
+          *   1. We are not collapsing BR's, or
+          *   2. (we are collapsing and) This line has text on it, or
+          *   3. (we are collapsing and) The previous line has text on it.
+          * Otherwise, don't do anything. -DH 980814
+          */
        if ((LYCollapseBRs == FALSE) ||
!           HText_LastLineSize(me->text, FALSE) ||
!           HText_PreviousLineSize(me->text, FALSE)) {
            HText_setLastChar(me->text, ' ');  /* absorb white space */
            HText_appendCharacter(me->text, '\r');
        }
*** lynx.cfg.orig       Fri Aug 14 11:08:23 1998
--- lynx.cfg    Fri Aug 14 11:13:43 1998
***************
*** 742,749 ****
  
  # If COLLAPSE_BR_TAGS is set FALSE, Lynx will not collapse serial BR tags.
  # Note that the valid way to insert extra blank lines in HTML is via a PRE
! # block with only newlines in the block.
! # The default is defined in userdefs.h, and can be overridden here.
  #
  #COLLAPSE_BR_TAGS:TRUE
  
--- 742,750 ----
  
  # If COLLAPSE_BR_TAGS is set FALSE, Lynx will not collapse serial BR tags.
  # Note that the valid way to insert extra blank lines in HTML is via a PRE
! # If set TRUE, two or more concurrent BRs will be collapsed into a single
! # blank line.  Note that the valid way to insert extra blank lines in HTML
! # is via a PRE block with only newlines in the block.
  #
  #COLLAPSE_BR_TAGS:TRUE
  
*** userdefs.h.orig     Fri Aug 14 11:08:03 1998
--- userdefs.h  Fri Aug 14 11:13:53 1998
***************
*** 802,809 ****
  
  /********************************
   * If COLLAPSE_BR_TAGS is set FALSE, Lynx will not collapse serial
!  * BR tags.  Note that the valid way to insert extra blank lines in
!  * HTML is via a PRE block with only newlines in the block.
   *
   * The default defined here can be changed in lynx.cfg.
   */
--- 802,811 ----
  
  /********************************
   * If COLLAPSE_BR_TAGS is set FALSE, Lynx will not collapse serial
!  * BR tags.  If set TRUE, two or more concurrent BRs will be collapsed
!  * into a single blank line.  Note that the valid way to insert extra
!  * blank lines in HTML is via a PRE block with only newlines in the
!  * block.
   *
   * The default defined here can be changed in lynx.cfg.
   */

David Henderson
--
Star Trek?  Psi Phi!  Visit http://www.psiphi.org/ for the latest news
and rumors about "Star Trek: Deep Space Nine" and "Star Trek: Voyager"
----------------------------------------------------------------------
<*> davidh at psiphi.org, davidh at imsa.edu, davidh at cyberdesic.com

reply via email to

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