lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev patch - search in partial mode (part1)


From: Leonid Pauzner
Subject: lynx-dev patch - search in partial mode (part1)
Date: Sun, 7 Nov 1999 01:24:58 +0300 (MSK)

Looking onto new modularizing mainloop I found out that LYK_WHEREIS search
could be added for partial mode relatively easy.


* reorganize the code: 'search_target' now became global, so display_page()
  and highlight() could be called from any place easily. This was a mainloop
  local variable (name changed from 'prev_target' to avoid conflict
  elsewhere), the value currently changed in mainloop(), handle_LYK_WHEREIS()
  and textsearch().
* Add user search in partial mode (while loading of the document is in
  progress). Scrolling to the string in question is not working properly
  yet if you repeat 'n' next time. More work required.



It is interesting enough that handle_LYK_WHEREIS() and textsearch() work
more or less properly while they call '&curdoc' but we load 'newdoc' in
fact. Therefor new line /link position is not saved as it should.
Some more play around handle_LYK_WHEREIS/www_search_result/Newline/etc.
is required, but that would be a light weighted fine turning patch (or a
couple).

Enjoy.



diff -u old/gridtext.c ./gridtext.c
--- old/gridtext.c      Thu Nov  4 16:55:46 1999
+++ ./gridtext.c        Sun Nov  7 00:24:40 1999
@@ -1671,10 +1671,9 @@
 /*     Output a page
 **     -------------
 */
-PRIVATE void display_page ARGS3(
+PRIVATE void display_page ARGS2(
        HText *,        text,
-       int,            line_number,
-       char *,         target)
+       int,            line_number)
 {
     HTLine * line = NULL;
     int i;
@@ -1694,6 +1693,7 @@
 #ifdef DISP_PARTIAL
     int last_disp_partial = -1;
 #endif
+    CONST char *target = search_target;  /* search_target is global */

     lynx_mode = NORMAL_LYNX_MODE;

@@ -1723,7 +1723,7 @@
 #endif /* DISP_PARTIAL */

     tmp[0] = tmp[1] = tmp[2] = '\0';
-    if (target && *target == '\0') target = NULL;
+/*    if (target && *target == '\0') target = NULL; */
     text->page_has_target = NO;
     if (display_lines <= 0) {
        /*  No screen space to display anything!
@@ -2167,7 +2167,7 @@
                /*
                 *  Bold the link after incrementing nlinks.
                 */
-               highlight(OFF, (nlinks - 1), target);
+               highlight(OFF, (nlinks - 1));

                display_flag = TRUE;

@@ -6647,9 +6647,8 @@
  *  starting from the line 'line_num'-1.
  *  This is the primary call for lynx.
  */
-PUBLIC void HText_pageDisplay ARGS2(
-       int,            line_num,
-       char *,         target)
+PUBLIC void HText_pageDisplay ARGS1(
+       int,            line_num)
 {
 #ifdef DISP_PARTIAL
     if (debug_display_partial || (LYTraceLogFP != NULL)) {
@@ -6673,7 +6672,7 @@
     }
 #endif

-    display_page(HTMainText, line_num-1, target);
+    display_page(HTMainText, line_num-1);

 #ifdef DISP_PARTIAL
     if (display_partial && debug_display_partial)
@@ -6744,7 +6743,7 @@
        HText *,        text)
 {
     if (text->stale)
-       display_page(text, text->top_of_screen, "");
+       display_page(text, text->top_of_screen);
 }

 PUBLIC int HText_sourceAnchors ARGS1(
@@ -6772,25 +6771,25 @@
 PUBLIC void HText_scrollTop ARGS1(
        HText *,        text)
 {
-    display_page(text, 0, "");
+    display_page(text, 0);
 }

 PUBLIC void HText_scrollDown ARGS1(
        HText *,        text)
 {
-    display_page(text, text->top_of_screen + display_lines, "");
+    display_page(text, text->top_of_screen + display_lines);
 }

 PUBLIC void HText_scrollUp ARGS1(
        HText *,        text)
 {
-    display_page(text, text->top_of_screen - display_lines, "");
+    display_page(text, text->top_of_screen - display_lines);
 }

 PUBLIC void HText_scrollBottom ARGS1(
        HText *,        text)
 {
-    display_page(text, text->Lines - display_lines, "");
+    display_page(text, text->Lines - display_lines);
 }


@@ -6858,7 +6857,7 @@
        if (loaded_texts && HTList_removeObject(loaded_texts, text))
            HTList_addObject(loaded_texts, text);
          /* let lynx do it */
-       /* display_page(text, text->top_of_screen, ""); */
+       /* display_page(text, text->top_of_screen); */
     }
     return YES;
 }
diff -u old/gridtext.h ./gridtext.h
--- old/gridtext.h      Thu Nov  4 16:55:46 1999
+++ ./gridtext.h        Sun Nov  7 00:24:44 1999
@@ -108,7 +108,7 @@
 extern void HText_scrollDown PARAMS((HText * text));   /* One page */
 extern void HText_scrollTop PARAMS((HText * text));
 extern void HText_scrollBottom PARAMS((HText * text));
-extern void HText_pageDisplay PARAMS((int line_num, char *target));
+extern void HText_pageDisplay PARAMS((int line_num));
 extern BOOL HText_pageHasPrevTarget NOPARAMS;

 extern int HText_LinksInLines PARAMS((HText *text, int line_num, int Lines));
diff -u old/htformat.c ./htformat.c
--- old/htformat.c      Thu Oct 21 03:15:28 1999
+++ ./htformat.c        Sun Nov  7 00:24:44 1999
@@ -541,7 +541,7 @@
                 */
        ) {
            NumOfLines_partial = HText_getNumOfLines();
-           HText_pageDisplay(Newline_partial, "");
+           HText_pageDisplay(Newline_partial);
        }
     }
 #else /* nothing */
diff -u old/lycurses.c ./lycurses.c
--- old/lycurses.c      Thu Nov  4 16:55:54 1999
+++ ./lycurses.c        Sun Nov  7 00:24:24 1999
@@ -4,7 +4,6 @@
 #include <LYStyle.h>
 #include <LYUtils.h>
 #include <LYGlobalDefs.h>
-#include <LYMainLoop.h>
 #include <LYSignal.h>
 #include <LYClean.h>
 #include <LYReadCFG.h>
diff -u old/lyglobal.h ./lyglobal.h
--- old/lyglobal.h      Thu Nov  4 16:55:56 1999
+++ ./lyglobal.h        Sun Nov  7 00:24:48 1999
@@ -290,6 +290,10 @@
 extern BOOLEAN display_partial_flag; /* permanent flag, not mutable */
 extern int Newline; /* original newline position, from mainloop() */
 #endif
+
+extern char search_target[512];  /* user search string:                   *
+                                  * used by highligt() and display_page(),*
+                                  * changed in LYMainLoop.c only          */
 extern char *form_post_data;         /* User data for post form */
 extern char *form_get_data;          /* User data for get form */
 extern char *http_error_file;        /* Place HTTP status code in this file */
diff -u old/lymainlo.c ./lymainlo.c
--- old/lymainlo.c      Thu Nov  4 16:56:06 1999
+++ ./lymainlo.c        Sun Nov  7 00:37:28 1999
@@ -196,6 +196,8 @@

 PUBLIC char * LYRequestTitle = NULL; /* newdoc.title in calls to getfile() */

+PUBLIC char search_target[512];      /* now global */
+
 #ifdef DISP_PARTIAL
 PUBLIC int Newline_partial = 0;     /* required for display_partial mode */
 PUBLIC int NumOfLines_partial = -1; /* initialize to -1 the very first time */
@@ -355,8 +357,7 @@
     return TRUE;
 }

-PRIVATE int do_change_link ARGS1(
-       char *,         prev_target)
+PRIVATE int do_change_link NOARGS
 {
     /* Is there a mouse-clicked link waiting? */
     int mouse_tmp = get_mouse_link();
@@ -364,7 +365,7 @@
     if (mouse_tmp != -1) {
        if (curdoc.link >= 0 && curdoc.link < nlinks
         && curdoc.link != mouse_tmp) {
-           highlight(OFF, curdoc.link, prev_target);
+           highlight(OFF, curdoc.link);
        }
        if (mouse_tmp < 0 || mouse_tmp >= nlinks) {
            char *msgtmp = NULL;
@@ -859,10 +860,9 @@
 }
 #endif

-PRIVATE int handle_LYK_ACTIVATE ARGS7(
+PRIVATE int handle_LYK_ACTIVATE ARGS6(
     int *,     c,
     int,       cmd GCC_UNUSED,
-    char *,    prev_target,
     BOOLEAN *, try_internal GCC_UNUSED,
     BOOLEAN *, refresh_screen,
     BOOLEAN *, force_load,
@@ -883,7 +883,7 @@
         return 0;
     }
 #endif
-    if (do_change_link(prev_target) == -1) {
+    if (do_change_link() == -1) {
        LYforce_no_cache = FALSE;
        reloading = FALSE;
        return 1;       /* mouse stuff was confused, ignore - kw */
@@ -1868,8 +1868,7 @@
 #endif /* VMS */
 #endif /* defined(DIRED_SUPPORT) || defined(VMS) */

-PRIVATE int handle_LYK_DOWNLOAD ARGS4(
-    char *,    prev_target,
+PRIVATE int handle_LYK_DOWNLOAD ARGS3(
     int *,     cmd,
     int *,     old_c,
     int,       real_c)
@@ -1894,7 +1893,7 @@
                DOWNLOAD_OPTIONS_TITLE))
        return 0;

-    if (do_change_link(prev_target) == -1)
+    if (do_change_link() == -1)
        return 1;       /* mouse stuff was confused, ignore - kw */
     if (nlinks > 0) {
        if (links[curdoc.link].type == WWW_FORM_LINK_TYPE) {
@@ -2115,8 +2114,7 @@
     }
 }

-PRIVATE void handle_LYK_DOWN_LINK ARGS4(
-    char *,    prev_target,
+PRIVATE void handle_LYK_DOWN_LINK ARGS3(
     int *,     follow_col,
     int *,     old_c,
     int,       real_c)
@@ -2133,7 +2131,7 @@

        newlink = find_link_near_col(*follow_col, 1);
        if (newlink > -1) {
-           highlight(OFF, curdoc.link, prev_target);
+           highlight(OFF, curdoc.link);
            curdoc.link = newlink;
        } else if (more) {  /* next page */
                Newline += (display_lines);
@@ -2570,9 +2568,8 @@
 }
 #endif

-PRIVATE BOOLEAN handle_LYK_FASTBACKW_LINK ARGS4(
+PRIVATE BOOLEAN handle_LYK_FASTBACKW_LINK ARGS3(
     int *,     cmd,
-    char *,    prev_target,
     int *,     old_c,
     int,       real_c)
 {
@@ -2653,7 +2650,7 @@
                    nextlink--;
                }
        }
-       highlight(OFF, curdoc.link, prev_target);
+       highlight(OFF, curdoc.link);
        curdoc.link = nextlink;
        return FALSE;           /* and we are done. */

@@ -2681,8 +2678,7 @@
     return FALSE;
 }

-PRIVATE void handle_LYK_FASTFORW_LINK ARGS3(
-    char *,    prev_target,
+PRIVATE void handle_LYK_FASTFORW_LINK ARGS2(
     int *,     old_c,
     int,       real_c)
 {
@@ -2724,7 +2720,7 @@
        }
     }
     if (samepage) {
-       highlight(OFF, curdoc.link, prev_target);
+       highlight(OFF, curdoc.link);
        curdoc.link = nextlink;
        return;         /* and we are done. */

@@ -2733,7 +2729,7 @@
      * Move to the top link on the page.
      */
     } else if (!more && Newline == 1 && curdoc.link == nlinks-1) {
-       highlight(OFF, curdoc.link, prev_target);
+       highlight(OFF, curdoc.link);
        curdoc.link = 0;

     } else if (more && /* need a later page */
@@ -3189,8 +3185,7 @@
     }
 }

-PRIVATE BOOLEAN handle_LYK_INFO ARGS2(
-    char *,    prev_target,
+PRIVATE BOOLEAN handle_LYK_INFO ARGS1(
     int *,     cmd)
 {
     /*
@@ -3198,7 +3193,7 @@
      */
     if (strcmp((curdoc.title ? curdoc.title : ""),
               SHOWINFO_TITLE)) {
-       if (do_change_link(prev_target) != -1
+       if (do_change_link() != -1
         && showinfo(&curdoc, HText_getNumOfLines(),
                     &newdoc, owner_address) >= 0) {
            StrAllocCopy(newdoc.title, SHOWINFO_TITLE);
@@ -3418,12 +3413,11 @@
     }
 }

-PRIVATE void handle_LYK_LEFT_LINK ARGS1(
-    char *,    prev_target)
+PRIVATE void handle_LYK_LEFT_LINK NOARGS
 {
     if (curdoc.link>0 &&
                links[curdoc.link].ly == links[curdoc.link-1].ly) {
-       highlight(OFF, curdoc.link, prev_target);
+       highlight(OFF, curdoc.link);
        curdoc.link--;
     }
 }
@@ -3463,8 +3457,7 @@
     return FALSE;
 }

-PRIVATE void handle_LYK_MAIN_MENU ARGS3(
-    char *,    prev_target,
+PRIVATE void handle_LYK_MAIN_MENU ARGS2(
     int *,     old_c,
     int,       real_c)
 {
@@ -3482,7 +3475,7 @@
            newdoc.isHEAD = FALSE;
            newdoc.safe = FALSE;
            newdoc.internal_link = FALSE;
-           highlight(OFF, curdoc.link, prev_target);
+           highlight(OFF, curdoc.link);
 #ifdef DIRED_SUPPORT
            if (lynx_edit_mode)
                HTuncache_current_document();
@@ -3733,14 +3726,13 @@
     return FALSE;
 }

-PRIVATE void handle_LYK_NEXT_LINK ARGS4(
+PRIVATE void handle_LYK_NEXT_LINK ARGS3(
     int,       c,
-    char *,    prev_target,
     int *,     old_c,
     int,       real_c)
 {
     if (curdoc.link < nlinks-1) {      /* next link */
-       highlight(OFF, curdoc.link, prev_target);
+       highlight(OFF, curdoc.link);
 #ifdef FASTTAB
        /*
         *  Move to different textarea if TAB in textarea.
@@ -3768,7 +3760,7 @@
      * Move to the top link on the page.
      */
     } else if (!more && Newline == 1 && curdoc.link == nlinks-1) {
-       highlight(OFF, curdoc.link, prev_target);
+       highlight(OFF, curdoc.link);
        curdoc.link = 0;

     } else if (more) { /* next page */
@@ -3780,15 +3772,14 @@
     }
 }

-PRIVATE void handle_LYK_NEXT_PAGE ARGS3(
-    char *,    prev_target,
+PRIVATE void handle_LYK_NEXT_PAGE ARGS2(
     int        *,      old_c,
     int,       real_c)
 {
     if (more) {
        Newline += display_lines;
     } else if (curdoc.link < nlinks-1) {
-       highlight(OFF, curdoc.link, prev_target);
+       highlight(OFF, curdoc.link);
        curdoc.link = nlinks-1;  /* put on last link */
     } else if (*old_c != real_c) {
        *old_c = real_c;
@@ -3818,8 +3809,7 @@
     return TRUE;
 }

-PRIVATE void handle_LYK_PREV_LINK ARGS4(
-    char *,    prev_target,
+PRIVATE void handle_LYK_PREV_LINK ARGS3(
     int *,     arrowup,
     int        *,      old_c,
     int,       real_c)
@@ -3828,7 +3818,7 @@
        /*
         *  Unhighlight current link.
         */
-       highlight(OFF, curdoc.link, prev_target);
+       highlight(OFF, curdoc.link);
        curdoc.link--;

     } else if (!more &&
@@ -3839,7 +3829,7 @@
         *  link and just move the cursor to last link on
         *  the page.
         */
-       highlight(OFF, curdoc.link, prev_target);
+       highlight(OFF, curdoc.link);
        curdoc.link = nlinks-1;  /* the last link */

     } else if (curdoc.line > 1) {      /* previous page */
@@ -3975,15 +3965,14 @@
     return 0;
 }

-PRIVATE void handle_LYK_PREV_PAGE ARGS3(
-    char *,    prev_target,
+PRIVATE void handle_LYK_PREV_PAGE ARGS2(
     int        *,      old_c,
     int,       real_c)
 {
     if (Newline > 1) {
        Newline -= display_lines;
     } else if (curdoc.link > 0) {
-       highlight(OFF, curdoc.link, prev_target);
+       highlight(OFF, curdoc.link);
        curdoc.link = 0;  /* put on first link */
     } else if (*old_c != real_c) {
        *old_c = real_c;
@@ -4142,12 +4131,11 @@
 }
 #endif /* DIRED_SUPPORT */

-PRIVATE void handle_LYK_RIGHT_LINK ARGS1(
-    char *,    prev_target)
+PRIVATE void handle_LYK_RIGHT_LINK NOARGS
 {
     if (curdoc.link<nlinks-1 &&
                links[curdoc.link].ly == links[curdoc.link+1].ly) {
-       highlight(OFF, curdoc.link, prev_target);
+       highlight(OFF, curdoc.link);
        curdoc.link++;
     }
 }
@@ -4338,8 +4326,7 @@
 }

 #ifdef DIRED_SUPPORT
-PRIVATE void handle_LYK_TAG_LINK ARGS1(
-    char *,    prev_target)
+PRIVATE void handle_LYK_TAG_LINK NOARGS
 {
     if (lynx_edit_mode && nlinks > 0 && !no_dired_support) {
        if (!strcmp(links[curdoc.link].hightext, ".."))
@@ -4376,10 +4363,10 @@
            }
        }
        if (curdoc.link < nlinks-1) {
-           highlight(OFF, curdoc.link, prev_target);
+           highlight(OFF, curdoc.link);
            curdoc.link++;
        } else if (!more && Newline == 1 && curdoc.link == nlinks-1) {
-           highlight(OFF, curdoc.link, prev_target);
+           highlight(OFF, curdoc.link);
            curdoc.link = 0;
        } else if (more) {  /* next page */
            Newline += (display_lines);
@@ -4476,7 +4463,7 @@
     LYforce_no_cache = TRUE;
 }

-PRIVATE void handle_LYK_TRACE_TOGGLE NOARGS
+PUBLIC void handle_LYK_TRACE_TOGGLE NOARGS
 {
     WWW_TraceFlag = ! WWW_TraceFlag;
     if (LYOpenTraceLog())
@@ -4540,8 +4527,7 @@
     }
 }

-PRIVATE void handle_LYK_UP_LINK ARGS5(
-    char *,    prev_target,
+PRIVATE void handle_LYK_UP_LINK ARGS4(
     int *,     follow_col,
     int *,     arrowup,
     int *,     old_c,
@@ -4563,7 +4549,7 @@

        newlink = find_link_near_col(*follow_col, -1);
        if (newlink > -1) {
-           highlight(OFF, curdoc.link, prev_target);
+           highlight(OFF, curdoc.link);
            curdoc.link = newlink;
        } else if (*old_c != real_c) {
            *old_c = real_c;
@@ -4697,42 +4683,41 @@
     return FALSE;
 }

-PRIVATE void handle_LYK_WHEREIS ARGS3(
+PUBLIC void handle_LYK_WHEREIS ARGS2(
     int,       cmd,
-    char *,    prev_target,
     BOOLEAN *, refresh_screen)
 {
-    BOOLEAN have_target_onscreen = (*prev_target != '\0' &&
+    BOOLEAN have_target_onscreen = (*search_target != '\0' &&
                                    HText_pageHasPrevTarget());
     BOOL found;
     int oldcur = curdoc.link; /* temporarily remember */
     char *remember_old_target = NULL;
     if (have_target_onscreen)
-       StrAllocCopy(remember_old_target, prev_target);
+       StrAllocCopy(remember_old_target, search_target);
     else
        StrAllocCopy(remember_old_target, "");

     if (cmd != LYK_NEXT) {
        /*
-        *  Reset prev_target to force prompting
+        *  Reset search_target to force prompting
         *  for a new search string and to turn
-        *  off highlighting in no search string
+        *  off highlighting if no search string
         *  is entered by the user.
         */
-       *prev_target = '\0';
-       found = textsearch(&curdoc, prev_target, FALSE);
+       *search_target = '\0';
+       found = textsearch(&curdoc, search_target, FALSE);
     } else {
        /*
         *  When the third argument is TRUE, the previous
         *  search string, if any, will be recalled from
-        *  a buffer, loaded into prev_target, and used
+        *  a buffer, loaded into search_target, and used
         *  for the search without prompting for a new
         *  search string.  This allows the LYK_NEXT
         *  command to repeat a search in a new document,
-        *  after prev_target was reset on fetch of that
+        *  after search_target was reset on fetch of that
         *  document.
         */
-       found = textsearch(&curdoc, prev_target, TRUE);
+       found = textsearch(&curdoc, search_target, TRUE);
     }

     /*
@@ -4756,9 +4741,9 @@
               curdoc.link >= 0 && nlinks > 0 &&
               links[curdoc.link].ly >= (display_lines/3)) {
        *refresh_screen = TRUE;
-    } else if ((case_sensitive && 0!=strcmp(prev_target,
+    } else if ((case_sensitive && 0!=strcmp(search_target,
                                            remember_old_target)) ||
-             (!case_sensitive && 0!=strcasecomp8(prev_target,
+             (!case_sensitive && 0!=strcasecomp8(search_target,
                                            remember_old_target))) {
        *refresh_screen = TRUE;
     }
@@ -4768,11 +4753,10 @@
 /*
  * Get a number from the user and follow that link number.
  */
-PRIVATE void handle_LYK_digit ARGS7(
+PRIVATE void handle_LYK_digit ARGS6(
     int,       c,
     BOOLEAN *, force_load,
     char *,    user_input_buffer,
-    char *,    prev_target,
     int *,     old_c,
     int,       real_c,
     BOOLEAN *, try_internal GCC_UNUSED)
@@ -4825,7 +4809,7 @@
                            newdoc.internal_link = curdoc.internal_link;
                            HTInfoMsg(CANCELLED);
                            if (nlinks > 0)
-                               HText_pageDisplay(curdoc.line, prev_target);
+                               HText_pageDisplay(curdoc.line);
                            break;
                        } else if (LYresubmit_posts) {
                            /* If LYresubmit_posts is set, and the
@@ -4911,7 +4895,7 @@
                     *  follow_link_number(), and re-initialize
                     *  the new link value. - FM
                     */
-                   highlight(OFF, curdoc.link, prev_target);
+                   highlight(OFF, curdoc.link);
                    curdoc.link = newdoc.link;
                    newdoc.link = 0;
                }
@@ -4977,7 +4961,6 @@
     int cmd = LYK_DO_NOTHING, real_cmd = LYK_DO_NOTHING;
     int getresult;
     int arrowup = FALSE, show_help = FALSE;
-    char prev_target[512];
     char user_input_buffer[MAX_LINE];
     CONST char *cshelpfile = NULL;
     BOOLEAN first_file = TRUE;
@@ -5008,7 +4991,7 @@
  *  curdoc.address contains the name of the file that is currently open.
  *  newdoc.address contains the name of the file that will soon be
  *                  opened if it exits.
- *  prev_target    contains the last search string the user searched for.
+ *  search_target  contains the last search string the user searched for.
  *  newdoc.title   contains the link name that the user last chose to get
  *                  into the current link (file).
  */
@@ -5031,7 +5014,7 @@
 #endif
     nhist = 0;
     user_input_buffer[(sizeof(user_input_buffer) - 1)] = '\0';
-    *prev_target = '\0';
+    *search_target = '\0';
     *user_input_buffer = '\0';
 #ifdef LY_FIND_LEAKS
     atexit(free_mainloop_variables);
@@ -5248,7 +5231,8 @@
                     !strcmp(newdoc.address, homepage))) {
                    LYPermitURL = TRUE;
                }
-
+
+               *search_target = '\0';  /* Reset for new coming document */
                Newline = newdoc.line; /* bypass for partial mode */
 #ifdef DISP_PARTIAL
                display_partial = display_partial_flag; /* restore */
@@ -5262,8 +5246,9 @@
                 * completed, but only if s/he did not mess screen up by
                 * scrolling before...  So fall down to old behavior here.
                 */
-               if (Newline_partial == 1 && strchr(newdoc.address, '#'))
+               if (newdoc.line == 1 && strchr(newdoc.address, '#')) {
                    display_partial = FALSE;
+               }
 #endif /* DISP_PARTIAL */
 #ifdef USE_PSRC
                psrc_first_tag = TRUE;
@@ -5559,7 +5544,6 @@
                        trace_mode_flag = FALSE;
                        fprintf(tfp, "Turning TRACE back on.\n\n");
                    }
-                   *prev_target = '\0';    /* Reset for this document. - FM */

                    /*
                     *  If it's the first file and we're interactive,
@@ -5719,6 +5703,7 @@
                    }
 #else
                    Newline = newdoc.line; /* now here, no partial mode */
+                   /* *search_target = '\0'; */ /* Reset for this document. - 
FM */
 #endif

                    /*
@@ -6033,7 +6018,7 @@

            refresh_screen = FALSE;

-           HText_pageDisplay(Newline, prev_target);
+           HText_pageDisplay(Newline);

 #ifdef DIRED_SUPPORT
            if (lynx_edit_mode && nlinks > 0 && !HTList_isEmpty(tagged))
@@ -6101,7 +6086,7 @@
 #else
            clear();
 #endif /* FANCY_CURSES || USE_SLANG */
-           HText_pageDisplay(Newline, prev_target);
+           HText_pageDisplay(Newline);

 #ifdef DIRED_SUPPORT
            if (lynx_edit_mode && nlinks > 0 && !HTList_isEmpty(tagged))
@@ -6225,7 +6210,7 @@
             /*
              *  Highlight current link.
              */
-           highlight(ON, curdoc.link, prev_target);
+           highlight(ON, curdoc.link);
        }

        if (traversal) {
@@ -6318,7 +6303,7 @@
                    old_c = 0;
                if (peek_mouse_link() >= 0 &&
                    LKC_TO_LAC(keymap,real_c) != LYK_CHANGE_LINK) {
-                   do_change_link(prev_target);
+                   do_change_link();
                    if ((c == '\n' || c == '\r') &&
                        links[curdoc.link].type == WWW_FORM_LINK_TYPE &&
                        (links[curdoc.link].form->type == F_TEXT_TYPE ||
@@ -6533,7 +6518,7 @@
        case LYK_7:
        case LYK_8:
        case LYK_9:
-           handle_LYK_digit(c, &force_load, user_input_buffer, prev_target,
+           handle_LYK_digit(c, &force_load, user_input_buffer,
                             &old_c, real_c, &try_internal);
            break;

@@ -6588,11 +6573,11 @@
            return(0);

        case LYK_NEXT_PAGE:     /* next page */
-           handle_LYK_NEXT_PAGE(prev_target, &old_c, real_c);
+           handle_LYK_NEXT_PAGE(&old_c, real_c);
            break;

        case LYK_PREV_PAGE:     /* page up */
-           handle_LYK_PREV_PAGE(prev_target, &old_c, real_c);
+           handle_LYK_PREV_PAGE(&old_c, real_c);
            break;

        case  LYK_UP_TWO:
@@ -6674,41 +6659,41 @@

        case LYK_PREV_LINK:
        case LYK_LPOS_PREV_LINK:
-           handle_LYK_PREV_LINK(prev_target, &arrowup, &old_c, real_c);
+           handle_LYK_PREV_LINK(&arrowup, &old_c, real_c);
            break;

        case LYK_NEXT_LINK:
        case LYK_LPOS_NEXT_LINK:
-           handle_LYK_NEXT_LINK(c, prev_target, &old_c, real_c);
+           handle_LYK_NEXT_LINK(c, &old_c, real_c);
            break;

        case LYK_FASTFORW_LINK:
-           handle_LYK_FASTFORW_LINK(prev_target, &old_c, real_c);
+           handle_LYK_FASTFORW_LINK(&old_c, real_c);
            break;

        case LYK_FASTBACKW_LINK:
-           if (handle_LYK_FASTBACKW_LINK(&cmd, prev_target, &old_c, real_c))
+           if (handle_LYK_FASTBACKW_LINK(&cmd, &old_c, real_c))
                goto new_cmd;
            break;

        case LYK_UP_LINK:
-           handle_LYK_UP_LINK(prev_target, &follow_col, &arrowup, &old_c, 
real_c);
+           handle_LYK_UP_LINK(&follow_col, &arrowup, &old_c, real_c);
            break;

        case LYK_DOWN_LINK:
-           handle_LYK_DOWN_LINK(prev_target, &follow_col, &old_c, real_c);
+           handle_LYK_DOWN_LINK(&follow_col, &old_c, real_c);
            break;

        case LYK_CHANGE_LINK:
-           do_change_link(prev_target);
+           do_change_link();
            break;

        case LYK_RIGHT_LINK:
-           handle_LYK_RIGHT_LINK(prev_target);
+           handle_LYK_RIGHT_LINK();
            break;

        case LYK_LEFT_LINK:
-           handle_LYK_LEFT_LINK(prev_target);
+           handle_LYK_LEFT_LINK();
            break;

        case LYK_COOKIE_JAR:       /* show the cookie jar */
@@ -6737,7 +6722,7 @@
            /* FALLTHRU */
        case LYK_ACTIVATE:      /* follow a link */
        case LYK_SUBMIT:        /* follow a link, submit TEXT_SUBMIT input */
-           switch (handle_LYK_ACTIVATE(&c, cmd, prev_target, &try_internal, 
&refresh_screen, &force_load, real_cmd)) {
+           switch (handle_LYK_ACTIVATE(&c, cmd, &try_internal, 
&refresh_screen, &force_load, real_cmd)) {
            case 1:
                continue;
            case 2:
@@ -6778,7 +6763,7 @@
            break;

        case LYK_MAIN_MENU:     /* return to main screen */
-           handle_LYK_MAIN_MENU(prev_target, &old_c, real_c);
+           handle_LYK_MAIN_MENU(&old_c, real_c);
            break;

        case LYK_OPTIONS:       /* options screen */
@@ -6792,7 +6777,7 @@

        case LYK_WHEREIS: /* search within the document */
        case LYK_NEXT:    /* search for the next occurrence in the document */
-           handle_LYK_WHEREIS(cmd, prev_target, &refresh_screen);
+           handle_LYK_WHEREIS(cmd, &refresh_screen);
            break;

        case LYK_COMMENT:       /* reply by mail */
@@ -6801,7 +6786,7 @@

 #ifdef DIRED_SUPPORT
        case LYK_TAG_LINK:      /* tag or untag the current link */
-           handle_LYK_TAG_LINK(prev_target);
+           handle_LYK_TAG_LINK();
            break;

        case LYK_MODIFY:        /* rename a file or directory */
@@ -6843,7 +6828,7 @@
 #endif /* DIRED_SUPPORT && OK_INSTALL */

        case LYK_INFO:          /* show document info */
-           if (handle_LYK_INFO(prev_target, &cmd))
+           if (handle_LYK_INFO(&cmd))
                goto new_cmd;
            break;

@@ -6909,7 +6894,7 @@
            break;

        case LYK_DOWNLOAD:
-           switch (handle_LYK_DOWNLOAD(prev_target, &cmd, &old_c, real_c)) {
+           switch (handle_LYK_DOWNLOAD(&cmd, &old_c, real_c)) {
            case 1:
                continue;
            case 2:
diff -u old/lymainlo.h ./lymainlo.h
--- old/lymainlo.h      Fri Jun 11 03:34:08 1999
+++ ./lymainlo.h        Sun Nov  7 00:30:46 1999
@@ -15,4 +15,9 @@
 extern void LYCloseTracelog NOPARAMS;
 extern void repaint_main_statusline NOPARAMS;

+/* made them available in partial mode */
+extern void handle_LYK_TRACE_TOGGLE  NOPARAMS;
+extern void handle_LYK_WHEREIS  PARAMS((int cmd, BOOLEAN *refresh_screen));
+
+
 #endif /* LYMAINLOOP_H */
diff -u old/lysearch.c ./lysearch.c
--- old/lysearch.c      Thu Aug 26 05:31:20 1999
+++ ./lysearch.c        Sun Nov  7 00:30:52 1999
@@ -351,7 +351,7 @@
        /*
         *  Found in link, changed cur, we're done.
         */
-       highlight(OFF, oldcur, prev_target);
+       highlight(OFF, oldcur);
        return(TRUE);
     }

@@ -371,7 +371,7 @@
      */
     www_user_search((cur_doc->line + offset), cur_doc, prev_target);
     if (cur_doc->link != oldcur) {
-       highlight(OFF, oldcur, prev_target);
+       highlight(OFF, oldcur);
        return(TRUE);
     }
     return (BOOL) (www_search_result > 0);
diff -u old/lystring.c ./lystring.c
--- old/lystring.c      Thu Nov  4 16:56:12 1999
+++ ./lystring.c        Sun Nov  7 00:24:26 1999
@@ -14,7 +14,9 @@
 #include <HTString.h>
 #include <LYCharUtils.h>
 #include <HTParse.h>
+#ifdef NCURSES_MOUSE_VERSION
 #include <LYMainLoop.h>
+#endif /* NCURSES_MOUSE_VERSION */

 #ifdef DJGPP_KEYHANDLER
 #include <pc.h>
@@ -1368,7 +1370,7 @@
     }
     return retlac;
 }
-#endif
+#endif /* NCURSES_MOUSE_VERSION */

 #if defined(USE_KEYMAPS) && defined(USE_SLANG)

diff -u old/lyutils.c ./lyutils.c
--- old/lyutils.c       Thu Nov  4 16:56:16 1999
+++ ./lyutils.c Sun Nov  7 00:30:54 1999
@@ -14,8 +14,10 @@
 #include <LYClean.h>
 #include <LYCharSets.h>
 #include <LYCharUtils.h>
+
 #include <LYMainLoop.h>
 #include <LYKeymap.h>
+#include <LYSearch.h>

 #ifdef __DJGPP__
 #include <go32.h>
@@ -119,10 +121,9 @@
 /*
  *  Highlight (or unhighlight) a given link.
  */
-PUBLIC void highlight ARGS3(
+PUBLIC void highlight ARGS2(
        int,            flag,
-       int,            cur,
-       char *,         target)
+       int,            cur)
 {
     char buffer[200];
     int i;
@@ -142,6 +143,7 @@
     BOOL hl2_drawn=FALSE;      /* whether links[cur].hightext2 is already drawn
                                   properly */
 #endif
+    CONST char *target = search_target;  /* search_target is global */
     tmp[0] = tmp[1] = tmp[2] = '\0';

     /*
@@ -2200,6 +2202,7 @@
 PUBLIC int HTCheckForInterrupt NOARGS
 {
     int c;
+    int cmd;
 #ifndef VMS /* UNIX stuff: */
 #ifndef USE_SLANG
     struct timeval socket_timeout;
@@ -2307,24 +2310,33 @@
        /* There is a subset of mainloop() actions available at this stage:
        ** no new getfile() cycle is possible until the previous finished.
        ** Currently we have scrolling in partial mode and toggling of trace
-       ** log.
+       ** log. User search now in progress...
        */
-    switch (LKC_TO_LAC(keymap,c))
+    cmd = (LKC_TO_LAC(keymap,c));
+    switch (cmd)
     {
-    case LYK_TRACE_TOGGLE :           /*  Toggle TRACE mode. */
-       WWW_TraceFlag = ! WWW_TraceFlag;
-       if (LYOpenTraceLog())
-           HTUserMsg(WWW_TraceFlag ? TRACE_ON : TRACE_OFF);
-       break ;
+    case LYK_TRACE_TOGGLE:     /*  Toggle TRACE mode. */
+           handle_LYK_TRACE_TOGGLE();
+           break;
     default :

 #ifdef DISP_PARTIAL
        if (display_partial && (NumOfLines_partial > 2))
        /* OK, we got several lines from new document and want to scroll... */
        {
+           BOOLEAN refresh;
            int res;
-           switch (LKC_TO_LAC(keymap,c))
+           switch (cmd)
            {
+           case LYK_WHEREIS: /* search within the document */
+           case LYK_NEXT:        /* search for the next occurrence in the 
document */
+               handle_LYK_WHEREIS(cmd, &refresh);
+               if (refresh && www_search_result != -1) {
+                       Newline_partial = www_search_result;
+                       www_search_result = -1;  /* reset */
+               }
+               break;
+
            case LYK_FASTBACKW_LINK :
                if (Newline_partial <= (display_lines)+1) {
                    Newline_partial -= display_lines ;
@@ -2393,7 +2405,7 @@
            if (Newline_partial < 1)
                Newline_partial = 1;
            NumOfLines_partial = HText_getNumOfLines();
-           HText_pageDisplay(Newline_partial, "");
+           HText_pageDisplay(Newline_partial);
        }
 #endif /* DISP_PARTIAL */
        break;
diff -u old/lyutils.h ./lyutils.h
--- old/lyutils.h       Mon Sep 13 20:07:18 1999
+++ ./lyutils.h Sun Nov  7 00:25:14 1999
@@ -118,7 +118,7 @@
 extern void change_sug_filename PARAMS((char *fname));
 extern void convert_to_spaces PARAMS((char *string, BOOL condense));
 extern void free_and_clear PARAMS((char **obj));
-extern void highlight PARAMS((int flag, int cur, char *target));
+extern void highlight PARAMS((int flag, int cur));
 extern void noviceline PARAMS((int more_flag));
 extern void parse_restrictions PARAMS((CONST char *s));
 extern void print_restrictions_to_fd PARAMS((FILE *fp));




reply via email to

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