[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev Re: dev22 - SOURCE_CACHE!=NONE and partial display mode
From: |
Leonid Pauzner |
Subject: |
lynx-dev Re: dev22 - SOURCE_CACHE!=NONE and partial display mode |
Date: |
Thu, 15 Apr 1999 17:07:07 +0400 (MSD) |
15-Apr-99 16:03 I wrote:
> This letter mostly to Scott Bigham since work in progress.
> I have fixed diplay partial mode for source cache operations,
> unfortunately, when the document reloaded from cache
> the screen than became blank or corrupted due to a highlighted link.
> Probably a problem in mainloop() somethere near the point you mentioned
> abouve.
> (Try the reloading of lynx users guide to source mode and wait until
> the reloading finished without any key scrolling operations).
> So I sent my current resync against clean dev22 (only files GridText.c,
> LYMainLoop.c, HTFormat.[ch], LYglobalDefs.h and LYMain.c are affected):
> * Fixes for SOURCE_CACHE!=NONE mode, trying to accomodate HTreparse_document()
> for mainloop() events:
> - fix switching to/from source mode when -prettysrc is in effect - VH & dsb.
> - fix case LYK_SOURCE - dsb
> - fix links numbering update - dsb
> - fix document length update - LP
> - add partial display mode for HTreparse_document() operations - LP
> (yes, I know this fix looks ugly, display partial staff should went
> from mainloop() to HT*Copy(), will be done later
> but how about corrupted screen?)
Now a better fix for display partial mode - more clean and should be used
for dev23 patch integration series. LYMain.c changes excluded.
More LYMainLoop.c and GridText.c changes welcome.
diff -u ./gridtext.c ../gridtext.c
--- ./gridtext.c Tue Apr 13 03:39:16 1999
+++ ../gridtext.c Thu Apr 15 16:27:52 1999
@@ -6210,12 +6211,17 @@
FREE(source_cache_filename);
return FALSE;
}
+#ifdef DISP_PARTIAL
+ display_partial = display_partial_flag; /* restore */
+ Newline_partial = Newline; /* initialize */
+#endif
ret = HTParseFile(format, HTOutputFormat, HTMainText->node_anchor,
fp, NULL);
fclose(fp);
ok = (ret == HT_LOADED);
- if (!ok)
+ if (!ok) {
FREE(source_cache_filename);
+ }
}
if (LYCacheSource == SOURCE_CACHE_MEMORY &&
@@ -6233,6 +6239,10 @@
source_cache_chunk = HTMainText->source_cache_chunk;
HTMainText->source_cache_chunk = NULL;
+#ifdef DISP_PARTIAL
+ display_partial = display_partial_flag; /* restore */
+ Newline_partial = Newline; /* initialize */
+#endif
ret = HTParseMem(format, HTOutputFormat, HTMainText->node_anchor,
source_cache_chunk, NULL);
ok = (ret == HT_LOADED);
diff -u ./htfile.c ../htfile.c
--- ./htfile.c Tue Apr 13 02:39:16 1999
+++ ../htfile.c Thu Apr 15 16:11:20 1999
@@ -522,6 +522,7 @@
#endif /* LY_FIND_LEAKS */
extern void HTDisplayPartial NOARGS;
+extern void HTFinishDisplayPartial NOARGS;
/* Send README file.
** -----------------
@@ -1822,6 +1823,7 @@
ABORT_TARGET;
}
}
+ HTFinishDisplayPartial();
return status; /* document loaded, maybe partial */
}
diff -u ./htformat.c ../htformat.c
--- ./htformat.c Tue Apr 13 03:39:16 1999
+++ ../htformat.c Thu Apr 15 16:23:02 1999
@@ -528,6 +528,30 @@
#endif /* DISP_PARTIAL */
}
+/* Put this as early as possible, OK just after HTDisplayPartial() */
+PUBLIC void HTFinishDisplayPartial NOARGS
+{
+#ifdef DISP_PARTIAL
+ if (display_partial) {
+ /*
+ * Override Newline with a new value if user
+ * scrolled the document while downloading.
+ */
+ if (Newline_partial != Newline
+ && NumOfLines_partial > 0)
+ Newline = Newline_partial;
+ }
+
+ /*
+ * End of incremental rendering stage here.
+ */
+ display_partial = FALSE;
+ NumOfLines_partial = -1; /* initialize to -1 */
+ /* -1 restrict HTDisplayPartial() */
+ /* until HText_new() start next HTMainText */
+ /* and set the flag to 0 */
+#endif /* DISP_PARTIAL */
+}
/* Push data from a socket down a stream
** -------------------------------------
@@ -697,6 +721,7 @@
rv = HT_LOADED;
finished:
+ HTFinishDisplayPartial();
return(rv);
}
@@ -768,6 +793,7 @@
}
} /* next bufferload */
+ HTFinishDisplayPartial();
return rv;
}
@@ -783,6 +809,7 @@
**
** Return values:
** HT_LOADED All data sent.
+** HT_INTERRUPTED Interruption after some data read.
**
** State of memory and target stream on return:
** always chunk unchanged, target stream still valid.
@@ -794,6 +821,7 @@
HTStreamClass targetClass = *(sink->isa);
int bytes = 0;
CONST char *data = chunk->data;
+ int rv = HT_OK;
HTReadProgress(0, 0);
for (;;) {
@@ -810,8 +838,20 @@
data += n;
HTReadProgress(bytes, 0);
HTDisplayPartial();
+
+ if (HTCheckForInterrupt()) {
+ _HTProgress (TRANSFER_INTERRUPTED);
+ if (bytes) {
+ rv = HT_INTERRUPTED;
+ } else {
+ rv = -1;
+ }
+ break;
+ }
}
- return HT_LOADED;
+
+ HTFinishDisplayPartial();
+ return rv;
}
#endif
@@ -891,6 +931,7 @@
}
} /* next bufferload */
+ HTFinishDisplayPartial();
return rv;
}
#endif /* USE_ZLIB */
diff -u ./lyglobal.h ../lyglobal.h
--- ./lyglobal.h Tue Apr 13 03:39:16 1999
+++ ../lyglobal.h Thu Apr 15 12:51:30 1999
@@ -271,6 +271,8 @@
extern int NumOfLines_partial; /* -//- "current" number of lines */
extern int partial_threshold;
extern BOOLEAN debug_display_partial; /* show with MessageSecs delay */
+extern BOOLEAN display_partial_flag; /* permanent flag, not mutable */
+extern int Newline; /* original newline position, from mainloop() */
#endif
extern char *form_post_data; /* User data for post form */
extern char *form_get_data; /* User data for get form */
diff -u ./lyhistor.c ../lyhistor.c
--- ./lyhistor.c Tue Apr 13 22:21:30 1999
+++ ../lyhistor.c Thu Apr 15 15:43:46 1999
@@ -335,7 +335,6 @@
#ifdef DISP_PARTIAL
/* assume we pop the 'doc' to show it soon... */
Newline_partial = doc->line; /* reinitialize */
- NumOfLines_partial = -1; /* initialize to -1 */
#endif /* DISP_PARTIAL */
CTRACE(tfp, "LYpop[%d]: address:%s\n title:%s\n",
nhist, doc->address, doc->title);
@@ -365,7 +364,6 @@
#ifdef DISP_PARTIAL
/* assume we pop the 'doc' to show it soon... */
Newline_partial = doc->line; /* reinitialize */
- NumOfLines_partial = -1; /* initialize to -1 */
#endif /* DISP_PARTIAL */
}
}
diff -u ./lymain.c ../lymain.c
--- ./lymain.c Tue Apr 13 03:39:16 1999
+++ ../lymain.c Wed Apr 14 19:37:42 1999
@@ -1584,6 +1584,13 @@
if (dump_output_immediately)
LYCacheSource = SOURCE_CACHE_NONE;
#endif
+#ifdef DISP_PARTIAL
+ /*
+ * Disable partial mode if not interactive.
+ */
+ if (dump_output_immediately)
+ display_partial = FALSE;
+#endif
#ifdef VMS
set_vms_keys();
diff -u ./lymainlo.c ../lymainlo.c
--- ./lymainlo.c Tue Apr 13 03:39:16 1999
+++ ../lymainlo.c Thu Apr 15 16:38:34 1999
@@ -85,7 +85,11 @@
#ifdef DISP_PARTIAL
PUBLIC int Newline_partial = 0; /* required for display_partial mode */
-PUBLIC int NumOfLines_partial = -1; /* required for display_partial mode */
+PUBLIC int NumOfLines_partial = -1; /* initialize to -1 the very first time */
+PUBLIC BOOLEAN display_partial_flag = FALSE;
+PUBLIC int Newline = 0;
+#else
+PRIVATE int Newline = 0;
#endif
PRIVATE document newdoc;
@@ -234,8 +238,6 @@
int cmd = LYK_DO_NOTHING, real_cmd = LYK_DO_NOTHING;
int getresult;
int arrowup = FALSE, show_help = FALSE;
- int lines_in_file = -1;
- int Newline = 0;
char prev_target[512];
char user_input_buffer[1024];
char *owner_address = NULL; /* Holds the responsible owner's address
*/
@@ -250,7 +252,7 @@
BOOLEAN rlink_allowed;
BOOLEAN vi_keys_flag = vi_keys;
BOOLEAN emacs_keys_flag = emacs_keys;
- BOOLEAN LYRawMode_flag = LYRawMode;
+ BOOLEAN LYUseDefaultRawMode_flag = LYUseDefaultRawMode;
#ifndef NO_OPTION_MENU
BOOLEAN LYSelectPopups_flag = LYSelectPopups;
BOOLEAN verbose_img_flag = verbose_img;
@@ -263,9 +265,6 @@
#endif
BOOLEAN trace_mode_flag = FALSE;
BOOLEAN forced_HTML_mode = LYforce_HTML_mode;
-#ifdef DISP_PARTIAL
- BOOLEAN display_partial_flag = display_partial;
-#endif
char cfile[128];
FILE *cfp;
char *cp, *toolbar;
@@ -312,6 +311,9 @@
user_input_buffer[(sizeof(user_input_buffer) - 1)] = '\0';
*prev_target = '\0';
*user_input_buffer = '\0';
+#ifdef DISP_PARTIAL
+ display_partial_flag = display_partial; /* permanent flag, not mutable */
+#endif
StrAllocCopy(CurrentUserAgent, (LYUserAgent ?
LYUserAgent : ""));
StrAllocCopy(CurrentNegoLanguage, (language ?
@@ -544,14 +546,10 @@
LYPermitURL = TRUE;
}
+ Newline = newdoc.line; /* bypass for partial mode */
#ifdef DISP_PARTIAL
- display_partial = display_partial_flag; /* restore */
- Newline_partial = newdoc.line; /* initialize */
- NumOfLines_partial = -1; /* initialize to -1 */
- /* -1 restrict HTDisplayPartial() */
- /* until HText_new() start new HTMainText */
- /* and set the flag to 0 */
- if (display_partial) {
+ display_partial = display_partial_flag; /* restore */
+ Newline_partial = Newline;
/*
* Disable display_partial if requested URL has #fragment
* and we are not popped from the history stack
@@ -561,10 +559,8 @@
* completed, but only if s/he did not mess screen up by
* scrolling before... So fall down to old behavior here.
*/
- if (!LYCursesON ||
- (Newline_partial == 1 && strchr(newdoc.address,
'#')))
+ if (Newline_partial == 1 && strchr(newdoc.address, '#'))
display_partial = FALSE;
- }
#endif /* DISP_PARTIAL */
#ifdef USE_PSRC
psrc_first_tag = TRUE;
@@ -990,6 +986,7 @@
newdoc.line = curdoc.line;
newdoc.link = curdoc.link;
newdoc.internal_link = FALSE; /* can't be true. - kw */
+ Newline = newdoc.line; /* now here, no partial mode */
}
/*
@@ -997,23 +994,9 @@
* line the user was on if s/he has been in the file
* before, or it is 1 if this is a new file.
*/
- Newline = newdoc.line;
-#ifdef DISP_PARTIAL
- if (display_partial) {
- /*
- * Override newdoc.line with a new value if user
- * scrolled the document while downloading.
- */
- if (Newline_partial != newdoc.line
- && NumOfLines_partial > 0)
- Newline = Newline_partial;
-
- /*
- * End of incremental rendering stage here.
- */
- display_partial = FALSE;
- }
-#endif /* DISP_PARTIAL */
+ /* Newline = newdoc.line; */
+ /* - alreary set and probably updated in partial mode */
+ /* End of incremental rendering stage here. */
/*
* If we are going to a target line or
@@ -1260,7 +1243,7 @@
#ifdef SOURCE_CACHE
/*
* If the parse settings have changed since this HText was
- * generated, we need to reparse and redraw it.
+ * generated, we need to reparse and redraw it. -dsb
*/
if (HTdocument_settings_changed()) {
HTUserMsg(gettext("Reparsing document under current settings..."));
@@ -1269,7 +1252,7 @@
else {
/*
* Urk. I have no idea how to recover from a failure here.
- * At a guess, I'll try reloading.
+ * At a guess, I'll try reloading. -dsb
*/
cmd = LYK_RELOAD;
goto new_cmd;
@@ -1298,7 +1281,6 @@
*/
more = HText_canScrollDown();
curdoc.line = Newline = HText_getTopOfScreen()+1;
- lines_in_file = HText_getNumOfLines();
if (curdoc.title == NULL) {
/*
@@ -1358,6 +1340,15 @@
if (lynx_edit_mode && nlinks > 0 && !HTList_isEmpty(tagged))
showtags(tagged);
#endif /* DIRED_SUPPORT */
+#ifdef SOURCE_CACHE
+ /*
+ * This information can get clobbered if we go to an internal
+ * page while viewing source. Normally it would be recreated
+ * by reloading the file; we have to do it ourselves. -dsb
+ */
+ if (curdoc.link < 0 && nlinks > 0)
+ curdoc.link = 0;
+#endif
if (user_mode == NOVICE_MODE)
noviceline(more); /* print help message */
refresh_screen = FALSE;
@@ -1671,7 +1662,6 @@
links[curdoc.link+1].form->name) !=
0)))))) {
HText_ExpandTextarea (&links[curdoc.link], 1);
- lines_in_file = HText_getNumOfLines();
if (links[curdoc.link].ly < display_lines) {
refresh_screen = TRUE;
@@ -2110,6 +2100,25 @@
#ifdef SOURCE_CACHE
if (HTreparse_document()) {
refresh_screen = TRUE;
+ /*
+ * These normally get cleaned up after getfile() returns;
+ * since we're not calling getfile(), we have to clean them
+ * up ourselves. -dsb
+ */
+ HTOutputFormat = WWW_PRESENT;
+#ifdef USE_PSRC
+ if (psrc_view)
+ HTMark_asSource();
+ psrc_view = FALSE;
+#endif
+ /*
+ * Set the remaining document elements.
+ */
+ if (ownerS_address != NULL) {
+ if (!HText_getOwner())
+ HText_setMainTextOwner(ownerS_address);
+ FREE(ownerS_address);
+ }
break;
}
#endif
@@ -2512,7 +2521,7 @@
case LYK_END:
if (more) {
- Newline = lines_in_file - display_lines + 3; /* go to end of
file */
+ Newline = HText_getNumOfLines() - display_lines + 3; /* go to
end of file */
arrowup = TRUE; /* position on last link */
} else {
cmd = LYK_NEXT_PAGE;
@@ -4037,7 +4046,7 @@
CurrentCharSet_flag != current_char_set ||
CurrentAssumeCharSet_flag != UCLYhndl_for_unspec ||
verbose_img_flag != verbose_img ||
- LYRawMode_flag != LYRawMode ||
+ LYUseDefaultRawMode_flag != LYUseDefaultRawMode ||
LYSelectPopups_flag != LYSelectPopups ||
((strcmp(CurrentUserAgent, (LYUserAgent ?
LYUserAgent : "")) ||
@@ -4113,7 +4122,7 @@
CurrentAssumeCharSet_flag = UCLYhndl_for_unspec;
show_dotfiles_flag = show_dotfiles;
verbose_img_flag = verbose_img;
- LYRawMode_flag = LYRawMode;
+ LYUseDefaultRawMode_flag = LYUseDefaultRawMode;
LYSelectPopups_flag = LYSelectPopups;
StrAllocCopy(CurrentUserAgent, (LYUserAgent ?
LYUserAgent : ""));
@@ -4656,7 +4665,7 @@
*/
if (strcmp((curdoc.title ? curdoc.title : ""),
SHOWINFO_TITLE)) {
- if (showinfo(&curdoc, lines_in_file,
+ if (showinfo(&curdoc, HText_getNumOfLines(),
&newdoc, owner_address) < 0)
break;
StrAllocCopy(newdoc.title, SHOWINFO_TITLE);
@@ -4698,8 +4707,6 @@
n = HText_ExtEditForm (&links[curdoc.link]);
- lines_in_file = HText_getNumOfLines();
-
/*
* TODO: Move cursor "n" lines from the current line to
* position it on the 1st trailing blank line in
@@ -4731,7 +4738,6 @@
HText_ExpandTextarea (&links[curdoc.link],
TEXTAREA_EXPAND_SIZE);
- lines_in_file = HText_getNumOfLines();
refresh_screen = TRUE;
} else {
@@ -4749,8 +4755,6 @@
n = HText_InsertFile (&links[curdoc.link]);
- lines_in_file = HText_getNumOfLines();
-
/*
* TODO: Move cursor "n" lines from the current line to
* position it on the 1st line following the text
@@ -4788,7 +4792,7 @@
PRINT_OPTIONS_TITLE)) {
if (print_options(&newdoc.address,
- &curdoc.address, lines_in_file) < 0)
+ &curdoc.address, HText_getNumOfLines()) < 0)
break;
StrAllocCopy(newdoc.title, PRINT_OPTIONS_TITLE);
FREE(newdoc.post_data);
@@ -5626,7 +5630,7 @@
LYUseDefaultRawMode = !LYUseDefaultRawMode;
HTUserMsg(LYRawMode ? RAWMODE_OFF : RAWMODE_ON);
HTMLSetCharacterHandling(current_char_set);
- LYRawMode_flag = LYRawMode;
+ LYUseDefaultRawMode_flag = LYUseDefaultRawMode;
#ifdef SOURCE_CACHE
if (HTreparse_document()) {
refresh_screen = TRUE;
- lynx-dev dev22 - patch to fix PSRC mode with SOURCE_CACHE!=NONE, Vlad Harchev, 1999/04/14
- Re: lynx-dev dev22 - patch to fix PSRC mode with SOURCE_CACHE!=NONE, Leonid Pauzner, 1999/04/14
- Re: lynx-dev dev22 - patch to fix PSRC mode with SOURCE_CACHE!=NONE, Scott Bigham, 1999/04/14
- Re: lynx-dev dev22 - patch to fix PSRC mode with SOURCE_CACHE!=NONE, Leonid Pauzner, 1999/04/14
- lynx-dev dev22 - SOURCE_CACHE!=NONE and partial display mode, Leonid Pauzner, 1999/04/15
- lynx-dev Re: dev22 - SOURCE_CACHE!=NONE and partial display mode,
Leonid Pauzner <=
- Re: lynx-dev Re: dev22 - SOURCE_CACHE!=NONE and partial display mode, Leonid Pauzner, 1999/04/15
- Re: lynx-dev dev22 - patch to fix PSRC mode with SOURCE_CACHE!=NONE, Klaus Weide, 1999/04/19
- Re: lynx-dev dev22 - patch to fix PSRC mode with SOURCE_CACHE!=NONE, Leonid Pauzner, 1999/04/19
- Re: lynx-dev dev22 - patch to fix PSRC mode with SOURCE_CACHE!=NONE, Klaus Weide, 1999/04/21
- Re: lynx-dev dev22 - patch to fix PSRC mode with SOURCE_CACHE!=NONE, Leonid Pauzner, 1999/04/21
- lynx-dev (long patch) SOURCE_CACHE!=NONE fixes and more, Leonid Pauzner, 1999/04/21
- Re: lynx-dev dev22 - patch to fix PSRC mode with SOURCE_CACHE!=NONE, Leonid Pauzner, 1999/04/19
- Re: lynx-dev dev22 - patch to fix PSRC mode with SOURCE_CACHE!=NONE, Scott Bigham, 1999/04/19
- Re: lynx-dev dev22 - patch to fix PSRC mode with SOURCE_CACHE!=NONE, Klaus Weide, 1999/04/21
- Re: lynx-dev dev22 - patch to fix PSRC mode with SOURCE_CACHE!=NONE, Scott Bigham, 1999/04/21