lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev avoiding screen refresh after partial display


From: Klaus Weide
Subject: lynx-dev avoiding screen refresh after partial display
Date: Wed, 25 Nov 1998 07:05:00 -0600 (CST)

Please test the appended patch.

Notes:

I hope this will also work for slang and for non-Unix.  But no promises.

The size_change(0) in the initial start_curses() for NCURSES did leave
recent_sizechange set (for me), which shouldn't be needed.  size_change(0)
for slang doesn't set recent_sizechange at all.

This may put too much knowledge about partial display into display_page,
but it felt safer to put the information (which lines were shown during
last partial) with the object that is affected (the HText *) rather than
relying on global flags. Leonid: this probably duplicates Newline_partial
and NumOfLines_partial, but should work independently of them.  I didn't
try to follow all the logic involved for them.


* Avoid setting recent_sizechange during the very first start_curses
  call for ncurses. This would result in an unnecessary refresh after
  loading the first document.
* Added logic to display_page to avoid repainting the full screen contents
  in a specific situation: if it has been called before (for the same lines
  in the same document) during partial display, and is now being called
  normally (not during partial display).  If this applies, the normal line
  content is not redrawn, but the title line and form fields are still
  repainted, and updating of the links structures is always done.
  There are additional checks for recent_sizechange and a text->stale flag
  (which was already implemented but unused) to do the full redraw if
  that may be needed.
  This should avoid unnecessary screen 'blinking' with curses when partial
  display is used (which didn't seem to happen with slang).
  
Diff against 2.8.1rel.2.

*** lynx2-8-1.orig/src/LYCurses.c       Sat Oct 10 15:53:16 1998
--- lynx2-8-1/src/LYCurses.c    Tue Nov 24 19:15:05 1998
***************
*** 763,768 ****
--- 763,769 ----
        }
  #if defined(SIGWINCH) && defined(NCURSES_VERSION)
        size_change(0);
+       recent_sizechange = FALSE; /* prevent mainloop drawing 1st doc twice */
  #endif /* SIGWINCH */
  #if defined(USE_KEYMAPS) && defined(NCURSES_VERSION)
        if (-1 == lynx_initialize_keymaps ())
*** lynx2-8-1.orig/src/LYMainLoop.c     Sat Oct 24 11:49:07 1998
--- lynx2-8-1/src/LYMainLoop.c  Tue Nov 24 19:14:02 1998
***************
*** 1091,1096 ****
--- 1091,1098 ----
                start_curses();
                clear();
                refresh_screen = TRUE; /* to force a redraw */
+               if (HTMainText) /* to REALLY force it... - kw */
+                   HText_setStale(HTMainText);
                recent_sizechange = FALSE;
                if (user_mode == NOVICE_MODE) {
                    display_lines = LYlines-4;
*** lynx2-8-1.orig/src/GridText.c       Wed Oct 14 07:23:56 1998
--- lynx2-8-1/src/GridText.c    Wed Nov 25 06:20:54 1998
***************
*** 183,188 ****
--- 183,192 ----
        BOOL                    in_line_1;              /* of paragraph */
        BOOL                    stale;                  /* Must refresh */
        BOOL                    page_has_target; /* has target on screen */
+ #ifdef DISP_PARTIAL
+       int                     first_lineno_last_disp_partial;
+       int                     last_lineno_last_disp_partial;
+ #endif
  
        HTkcode                 kcode;                  /* Kanji code? */
        enum grid_state       { S_text, S_esc, S_dollar, S_paren,
***************
*** 534,539 ****
--- 538,552 ----
       */
      if (display_partial)
         NumOfLines_partial = 0;  /* enable HTDisplayPartial() */
+ 
+     /*
+      *  These two fields should only be set to valid line numbers
+      *  by calls of display_page during partial displaying.  This
+      *  is just so that the FIRST display_page AFTER that can avoid
+      *  repainting the same lines on the screen. - kw
+      */
+     self->first_lineno_last_disp_partial =
+       self->last_lineno_last_disp_partial = -1;
  #endif
  
      CTRACE(tfp, "GridText: start HText_new\n");
***************
*** 1045,1050 ****
--- 1058,1066 ----
      HTAnchor *link_dest_intl = NULL;
      static int last_nlinks = 0;
      static int charset_last_displayed = -1;
+ #ifdef DISP_PARTIAL
+     int last_disp_partial = -1;
+ #endif
  
      lynx_mode = NORMAL_LYNX_MODE;
  
***************
*** 1065,1070 ****
--- 1081,1094 ----
        return;
      }
  
+ #ifdef DISP_PARTIAL
+     if (display_partial || recent_sizechange || text->stale) {
+       /*  Reset them, will be set near end if all is okay. - kw */
+       text->first_lineno_last_disp_partial =
+           text->last_lineno_last_disp_partial = -1;
+     }
+ #endif /* DISP_PARTIAL */
+ 
      tmp[0] = tmp[1] = tmp[2] = '\0';
      text->page_has_target = NO;
      last_screen = text->Lines - (display_lines - 2);
***************
*** 1166,1171 ****
--- 1190,1203 ----
  #else
            assert(line != NULL);
  #endif /* !VMS */
+ 
+ #ifdef DISP_PARTIAL
+           if (!display_partial &&
+               line_number == text->first_lineno_last_disp_partial &&
+               i + line_number <= text->last_lineno_last_disp_partial)
+               move((i + 2), 0);
+           else
+ #endif
            display_line(line, text);
  
  #if defined(FANCY_CURSES) || defined(USE_SLANG)
***************
*** 1347,1352 ****
--- 1379,1393 ----
                }
                break;
            }
+ #ifdef DISP_PARTIAL
+           if (display_partial) {
+               /*
+                *  Remember as fully shown during last partial display,
+                *  if it was not the last text line. - kw
+                */
+               last_disp_partial = i + line_number;
+           }
+ #endif /* DISP_PARTIAL */
            display_flag = TRUE;
            line = line->next;
        } /* end of "Verify and display each line." loop */
***************
*** 1539,1544 ****
--- 1580,1597 ----
         */
        addstr("\n     Document is empty");
      }
+ 
+ #ifdef DISP_PARTIAL
+     if (display_partial && display_flag &&
+       last_disp_partial >= text->top_of_screen &&
+       !recent_sizechange) {   /*  really remember them if ok - kw  */
+       text->first_lineno_last_disp_partial = text->top_of_screen;
+       text->last_lineno_last_disp_partial = last_disp_partial;
+     } else {
+       text->first_lineno_last_disp_partial =
+           text->last_lineno_last_disp_partial = -1;
+     }
+ #endif /* DISP_PARTIAL */
  
      if (HTCJK != NOCJK || text->T.output_utf8) {
        /*

reply via email to

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