lynx-dev
[Top][All Lists]
Advanced

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

Re: lynx-dev dev22 - patch to fix PSRC mode with SOURCE_CACHE!=NONE


From: Leonid Pauzner
Subject: Re: lynx-dev dev22 - patch to fix PSRC mode with SOURCE_CACHE!=NONE
Date: Wed, 14 Apr 1999 19:23:21 +0400 (MSD)

13-Apr-99 21:29 Vlad Harchev wrote:
>  I have the following problem with dev22:
>  When pressing '\' on non-local files, the psrc view is shown, but there is no
> way out of this mode. This patch will fix it.

>  Best regards,
>   -Vlad

Thanks for you fix!  More problems found with SOURCE_CACHE!=NONE:
the length of the re-rendered text may vary so the scrolling down
is broken (especially nice when switching to source).
This patch will fix it ("more" updated, "lines_in_file" inlined),
also include your changes so applied to clean dev22).

More problems expected since we now reload documents
out of mainloop() cyrcle.


diff -u old/gridtext.c ./gridtext.c
--- old/gridtext.c      Tue Apr 13 23:11:32 1999
+++ ./gridtext.c        Wed Apr 14 18:57:06 1999
@@ -6215,8 +6215,9 @@
                          fp, NULL);
        fclose(fp);
        ok = (ret == HT_LOADED);
-       if (!ok)
+       if (!ok) {
            FREE(source_cache_filename);
+        }
     }

     if (LYCacheSource == SOURCE_CACHE_MEMORY &&
@@ -6244,6 +6245,15 @@
     }

     CTRACE(tfp, "Reparse %s\n", (ok ? "succeeded" : "failed"));
+
+    if (ok)  {/* fix few flags: */
+#ifdef USE_PSRC
+       if (LYpsrc && psrc_view)
+           HTMainText->source=TRUE;
+#endif
+       more = HText_canScrollDown();  /* the length may be changed */
+    }
+
     return ok;
 }

diff -u old/lymainlo.c ./lymainlo.c
--- old/lymainlo.c      Wed Apr 14 04:32:12 1999
+++ ./lymainlo.c        Wed Apr 14 19:01:42 1999
@@ -234,7 +234,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];
@@ -1298,7 +1296,6 @@
             */
            more = HText_canScrollDown();
            curdoc.line = Newline = HText_getTopOfScreen()+1;
-           lines_in_file = HText_getNumOfLines();

            if (curdoc.title == NULL) {
                /*
@@ -1671,7 +1668,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;
@@ -2512,7 +2508,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;
@@ -4656,7 +4652,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 +4694,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 +4725,6 @@

                HText_ExpandTextarea (&links[curdoc.link], 
TEXTAREA_EXPAND_SIZE);

-               lines_in_file  = HText_getNumOfLines();
                refresh_screen = TRUE;

            } else {
@@ -4749,8 +4742,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 +4779,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);





reply via email to

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