diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1999-11-18 04:13:09 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1999-11-18 04:13:09 -0500 |
commit | 45f1aadc261561566cd074da1d9b0fb21a6ad78c (patch) | |
tree | b1d2c414300b50815acb7b986077556e5dda712d /src | |
parent | 0f88481e93b50612489cc8e5b1ca365196439373 (diff) | |
download | lynx-snapshots-45f1aadc261561566cd074da1d9b0fb21a6ad78c.tar.gz |
snapshot of project "lynx", label v2-8-3dev_15
Diffstat (limited to 'src')
-rw-r--r-- | src/GridText.c | 100 | ||||
-rw-r--r-- | src/GridText.h | 4 | ||||
-rw-r--r-- | src/HTForms.h | 3 | ||||
-rw-r--r-- | src/LYBookmark.c | 4 | ||||
-rw-r--r-- | src/LYCharUtils.c | 2 | ||||
-rw-r--r-- | src/LYCurses.c | 20 | ||||
-rw-r--r-- | src/LYEditmap.c | 209 | ||||
-rw-r--r-- | src/LYForms.c | 38 | ||||
-rw-r--r-- | src/LYGetFile.c | 27 | ||||
-rw-r--r-- | src/LYGlobalDefs.h | 8 | ||||
-rw-r--r-- | src/LYHistory.c | 253 | ||||
-rw-r--r-- | src/LYKeymap.c | 153 | ||||
-rw-r--r-- | src/LYKeymap.h | 3 | ||||
-rw-r--r-- | src/LYMain.c | 9 | ||||
-rw-r--r-- | src/LYMainLoop.c | 296 | ||||
-rw-r--r-- | src/LYMainLoop.h | 11 | ||||
-rw-r--r-- | src/LYOptions.c | 22 | ||||
-rw-r--r-- | src/LYReadCFG.c | 13 | ||||
-rw-r--r-- | src/LYSearch.c | 58 | ||||
-rw-r--r-- | src/LYStrings.c | 6 | ||||
-rw-r--r-- | src/LYStrings.h | 2 | ||||
-rw-r--r-- | src/LYStructs.h | 13 | ||||
-rw-r--r-- | src/LYUtils.c | 67 | ||||
-rw-r--r-- | src/LYUtils.h | 2 | ||||
-rw-r--r-- | src/TRSTable.c | 3 | ||||
-rw-r--r-- | src/makefile.dos | 56 | ||||
-rw-r--r-- | src/makefile.dsl | 52 |
27 files changed, 1058 insertions, 376 deletions
diff --git a/src/GridText.c b/src/GridText.c index 8aae54af..b8bdeba6 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -1671,10 +1671,9 @@ PRIVATE void display_scrollbar ARGS1( /* 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 @@ PRIVATE void display_page ARGS3( #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,6 @@ PRIVATE void display_page ARGS3( #endif /* DISP_PARTIAL */ tmp[0] = tmp[1] = tmp[2] = '\0'; - if (target && *target == '\0') target = NULL; text->page_has_target = NO; if (display_lines <= 0) { /* No screen space to display anything! @@ -2167,7 +2166,7 @@ PRIVATE void display_page ARGS3( /* * Bold the link after incrementing nlinks. */ - highlight(OFF, (nlinks - 1), target); + highlight(OFF, (nlinks - 1)); display_flag = TRUE; @@ -2309,6 +2308,14 @@ PUBLIC void HText_beginAppend ARGS1( */ #define new_line(text) split_line(text, 0) +#define DEBUG_SPLITLINE + +#ifdef DEBUG_SPLITLINE +#define CTRACE_SPLITLINE(p) CTRACE(p) +#else +#define CTRACE_SPLITLINE(p) /*nothing*/ +#endif + PRIVATE void split_line ARGS2( HText *, text, unsigned, split) @@ -2329,7 +2336,6 @@ PRIVATE void split_line ARGS2( int TailTrim = 0; int s; -#define DEBUG_SPLITLINE /* * Make new line. */ @@ -2432,7 +2438,7 @@ PRIVATE void split_line ARGS2( alignment != HT_LEFT || style->wordWrap || style->freeFormat || style->spaceBefore || style->spaceAfter)) || - *p == LY_SOFT_HYPHEN) { + *p == LY_SOFT_HYPHEN) { p++; HeadTrim++; } @@ -2776,10 +2782,11 @@ PRIVATE void split_line ARGS2( IS_UTF_EXTRA(*cp) || *cp == LY_SOFT_HYPHEN) ctrl_chars_on_previous_line++; - if ((previous->size > 0) && - (int)(previous->data[previous->size-1] == LY_SOFT_HYPHEN)) - ctrl_chars_on_previous_line--; } + if ((previous->size > 0) && + (int)(previous->data[previous->size-1] == LY_SOFT_HYPHEN)) + ctrl_chars_on_previous_line--; + /* @@ first line indent */ spare = (LYcols-1) - (int)style->rightIndent - indent + @@ -2895,10 +2902,7 @@ PRIVATE void split_line ARGS2( if (!old_e && (!a->number || a->show_anchor) && a0 <= s + HeadTrim) { -#ifdef DEBUG_SPLITLINE - CTRACE((tfp, "anchor %d case %d: ", - a->number,1)); -#endif + CTRACE_SPLITLINE((tfp, "anchor %d case %d: ", a->number,1)); /* * It is meant to be empty, and/or endAnchor * has seen it and recognized it as empty. @@ -2914,10 +2918,7 @@ PRIVATE void split_line ARGS2( } else if (old_e && a0 >= s - TailTrim && a0 <= s + HeadTrim && a1 <= s + HeadTrim) { -#ifdef DEBUG_SPLITLINE - CTRACE((tfp, "anchor %d case %d: ", - a->number,2)); -#endif + CTRACE_SPLITLINE((tfp, "anchor %d case %d: ", a->number,2)); /* * endAnchor has seen it, it is effectively empty * after our trimming, but endAnchor has for some @@ -2936,19 +2937,13 @@ PRIVATE void split_line ARGS2( } new_ext = 0; } else if (a0 >= s + HeadTrim) { -#ifdef DEBUG_SPLITLINE - CTRACE((tfp, "anchor %d case %d: ", - a->number,3)); -#endif + CTRACE_SPLITLINE((tfp, "anchor %d case %d: ", a->number,3)); /* * Completely after split, just shift. */ new_pos = a0 - TailTrim + 1 - HeadTrim + SpecialAttrChars; } else if (!old_e) { -#ifdef DEBUG_SPLITLINE - CTRACE((tfp, "anchor %d case %d: ", - a->number,4)); -#endif + CTRACE_SPLITLINE((tfp, "anchor %d case %d: ", a->number,4)); /* * No extent set, we may still be growing it. */ @@ -2966,24 +2961,15 @@ PRIVATE void split_line ARGS2( */ } else if (a0 < s - TailTrim && a1 > s + HeadTrim) { -#ifdef DEBUG_SPLITLINE - CTRACE((tfp, "anchor %d case %d: ", - a->number,5)); -#endif + CTRACE_SPLITLINE((tfp, "anchor %d case %d: ", a->number,5)); new_pos = a0; new_ext = old_e - TailTrim - HeadTrim + SpecialAttrChars; } else if (a0 < s - TailTrim) { -#ifdef DEBUG_SPLITLINE - CTRACE((tfp, "anchor %d case %d: ", - a->number,6)); -#endif + CTRACE_SPLITLINE((tfp, "anchor %d case %d: ", a->number,6)); new_pos = a0; new_ext = s - TailTrim - a0; } else if (a1 > s + HeadTrim) { -#ifdef DEBUG_SPLITLINE - CTRACE((tfp, "anchor %d case %d: ", - a->number,7)); -#endif + CTRACE_SPLITLINE((tfp, "anchor %d case %d: ", a->number,7)); new_pos = s - TailTrim + 1 + SpecialAttrChars; new_ext = old_e - (s + HeadTrim - a0); } else { @@ -2996,11 +2982,9 @@ PRIVATE void split_line ARGS2( a->line_num,a->start,a->line_pos,a->extent)); continue; } -#ifdef DEBUG_SPLITLINE - CTRACE((tfp, "(T,H,S)=(%d,%d,%d); (line,start,pos,ext):(%d,%d,%d,%d", + CTRACE_SPLITLINE((tfp, "(T,H,S)=(%d,%d,%d); (line,start,pos,ext):(%d,%d,%d,%d", TailTrim,HeadTrim,SpecialAttrChars, a->line_num,a->start,a->line_pos,a->extent)); -#endif if (new_pos != a->line_pos) a->start = new_pos + d; if (new_pos > s - TailTrim) { @@ -3010,11 +2994,8 @@ PRIVATE void split_line ARGS2( a->line_pos = new_pos; a->extent = new_ext; -#ifdef DEBUG_SPLITLINE - CTRACE((tfp, "))->(%d,%d,%d,%d)\n", + CTRACE_SPLITLINE((tfp, "))->(%d,%d,%d,%d)\n", a->line_num,a->start,a->line_pos,a->extent)); -#endif - } } } @@ -6312,7 +6293,7 @@ PUBLIC BOOL HText_getFirstTargetInLine ARGS7( int *, offset, int *, tLen, char **, data, - char *, target) + CONST char *, target) { HTLine *line; char *LineData; @@ -6647,9 +6628,8 @@ PUBLIC CONST char * HText_getServer NOARGS * 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 +6653,7 @@ PUBLIC void HText_pageDisplay ARGS2( } #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 +6724,7 @@ PUBLIC void HText_refresh ARGS1( 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 +6752,25 @@ PUBLIC BOOL HText_canScrollDown NOARGS 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 +6838,7 @@ PUBLIC BOOL HText_select ARGS1( 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; } @@ -11720,6 +11700,10 @@ PRIVATE void insert_new_textarea_anchor ARGS2( #if defined(USE_COLOR_STYLE) /* dup styles[] if needed [no need in TEXTAREA (?); leave 0's] */ l->numstyles = htline->numstyles; +#ifndef OLD_HTSTYLECHANGE + /*we fork the pointers!*/ + l->styles = htline->styles; +#endif #endif strcpy (l->data, htline->data); if (keypad_mode == LINKS_AND_FIELDS_ARE_NUMBERED) { @@ -12589,6 +12573,10 @@ PUBLIC int HText_InsertFile ARGS1( #if defined(USE_COLOR_STYLE) /* dup styles[] if needed [no need in TEXTAREA (?); leave 0's] */ l->numstyles = htline->numstyles; +#ifndef OLD_HTSTYLECHANGE + /*we fork the pointers!*/ + l->styles = htline->styles; +#endif #endif strcpy (l->data, htline->data); diff --git a/src/GridText.h b/src/GridText.h index 1f82ec73..c5b05dd2 100644 --- a/src/GridText.h +++ b/src/GridText.h @@ -108,7 +108,7 @@ extern void HText_scrollUp PARAMS((HText * text)); /* One page */ 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)); @@ -163,7 +163,7 @@ extern BOOL HText_getFirstTargetInLine PARAMS(( int * offset, int * tLen, char ** data, - char * target)); + CONST char * target)); extern int HTisDocumentSource NOPARAMS; extern void HTuncache_current_document NOPARAMS; #ifdef SOURCE_CACHE diff --git a/src/HTForms.h b/src/HTForms.h index eb746376..10c383d0 100644 --- a/src/HTForms.h +++ b/src/HTForms.h @@ -147,6 +147,7 @@ typedef struct _PerFormInfo #define LAST_ORDER 3 /* in LYForms.c */ -extern void show_formlink_statusline PARAMS((CONST FormInfo * form)); +extern void show_formlink_statusline PARAMS((CONST FormInfo * form, + int for_what)); #endif /* HTFORMS_H */ diff --git a/src/LYBookmark.c b/src/LYBookmark.c index c43405b9..3cf838ca 100644 --- a/src/LYBookmark.c +++ b/src/LYBookmark.c @@ -598,9 +598,9 @@ PUBLIC void remove_bookmark_link ARGS2( #if defined(_WINDOWS) || defined(WIN_EX) #if defined(WIN_EX) if (GetLastError() == ERROR_NOT_SAME_DEVICE) -#else /* !_WIN_CC */ +#else /* !_WIN_EX */ if (errno == ENOTSAM) -#endif /* _WIN_CC */ +#endif /* _WIN_EX */ { if (rename(newfile, filename_buffer) != 0) { if (LYCopyFile(newfile, filename_buffer) == 0) diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index e48aaf8b..af30d9ce 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -476,7 +476,7 @@ PUBLIC void LYFillLocalFileURL ARGS2( * a listing for the login directory. - FM */ if (!strcmp(*href, "file://localhost/")) - StrAllocCat(*href, (HTVMS_wwwName((char *)Home_Dir())+1)); + StrAllocCat(*href, (HTVMS_wwwName(Home_Dir())+1)); #endif /* VMS */ FREE(temp); diff --git a/src/LYCurses.c b/src/LYCurses.c index e804da1e..e75218a3 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -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> @@ -519,21 +518,6 @@ PRIVATE void LYsetWAttr ARGS1(WINDOW *, win) code |= 4; attr = lynx_color_cfg[code].attr; - /* - * no_color_video is implemented in ncurses 4.2, but not in other - * flavors of curses. So we check before adding video attributes that - * might conflict with colors. For A_BOLD, check for both the bold and - * standout mask items because standout often uses bold in conjunction - * with another attribute. -TD - */ - if ((Current_Attr & A_BOLD) && !(NoColorVideo & 33)) { - attr |= A_BOLD; - } - - if ((Current_Attr & A_UNDERLINE) && !(NoColorVideo & 2)) { - attr |= A_UNDERLINE; - } - if (code+offs < COLOR_PAIRS) { attr |= COLOR_PAIR(code+offs); } @@ -1810,9 +1794,11 @@ PUBLIC void lynx_force_repaint NOARGS else a = A_NORMAL; bkgdset(a | ' '); -#ifndef USE_COLOR_STYLE +#if !defined(USE_COLOR_STYLE) && defined(NCURSES_VERSION) +#if NCURSES_VERSION_MAJOR < 4 || (NCURSES_VERSION_MAJOR == 4 && NCURSES_VERSION_MINOR == 0) bkgd(a | ' '); #endif +#endif attrset(a); #endif /* COLOR_CURSES */ clearok(curscr, TRUE); diff --git a/src/LYEditmap.c b/src/LYEditmap.c index 4a23b319..7a50a9ce 100644 --- a/src/LYEditmap.c +++ b/src/LYEditmap.c @@ -1051,11 +1051,218 @@ PUBLIC int LYRemapEditBinding ARGS2( } /* + * Macro to walk through lkc-indexed tables up to imax, in the (ASCII) order + * 97 - 122 ('a' - 'z'), + * 32 - 96 (' ' - '`', includes 'A' - 'Z'), + * 123 - 126 ('{' - '~'), + * 0 - 31 (^@ - ^_), + * 256 - imax, + * 127 - 255 + */ +#define NEXT_I(i,imax) ((i==122) ? 32 : (i==96) ? 123 : (i==126) ? 0 :\ + (i==31) ? 256 : (i==imax) ? 127 :\ + (i==255) ? (-1) :i+1) +#define FIRST_I 97 + +PUBLIC int LYKeyForEditAction ARGS1( + int, lec) +{ + int editaction, i; + for (i = FIRST_I; i >= 0; i = NEXT_I(i,KEYMAP_SIZE-2)) { + editaction = LYLineEditors[current_lineedit][i]; + if (editaction == lec) { +#ifdef NOT_ASCII + if (i < 256) { + return FROMASCII(i); + } else +#endif + return i; + } + } + return (-1); +} + +/* + * Given a lynxactioncode, return a key (lynxkeycode) or sequence + * of two keys that results in the given action while forms-editing. + * The main keycode is returned as function value, possibly with modifier + * bits set; in addition, if applicable, a key that sets the required + * modifier flag is returned in *pmodkey if (pmodkey!=NULL). + * Non-lineediting bindings that would require typing LYE_LKCMD (default ^V) + * to activate are not checked here, the caller should do that separately if + * required. If no key is bound by current line-editor bindings to the + * action, -1 is returned. + * This is all a bit long - it is general enough to continue to work + * should the three Mod<N>Binding[] become different tables. - kw + */ +PUBLIC int LYEditKeyForAction ARGS2( + int, lac, + int *, pmodkey) +{ + int editaction, i, c; + int mod1found = -1, mod2found = -1, mod3found = -1; + if (pmodkey) + *pmodkey = -1; + for (i = FIRST_I; i >= 0; i = NEXT_I(i,KEYMAP_SIZE-2)) { + editaction = LYLineEditors[current_lineedit][i]; +#ifdef NOT_ASCII + if (i < 256) { + c = FROMASCII(i); + } else +#endif + c = i; + if (editaction == (lac | LYE_FORM_LAC)) + return c; + if (editaction == LYE_FORM_PASS) { +#if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) + if (lynx_edit_mode && !no_dired_support && lac && + LKC_TO_LAC(key_override,c) == lac) + return c; +#endif /* DIRED_SUPPORT && OK_OVERRIDE */ + if (LKC_TO_LAC(keymap,c) == lac) + return c; + } + if (editaction == LYE_TAB) { +#if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) + if (lynx_edit_mode && !no_dired_support && lac && + LKC_TO_LAC(key_override,'\t') == lac) + return c; +#endif /* DIRED_SUPPORT && OK_OVERRIDE */ + if (LKC_TO_LAC(keymap,'\t') == lac) + return c; + } + if (editaction == LYE_SETM1 && mod1found < 0) + mod1found = i; + if (editaction == LYE_SETM2 && mod2found < 0) + mod2found = i; + if ((editaction & LYE_DF) && mod3found < 0) + mod3found = i; + } + if (mod3found >= 0) { + for (i = mod3found; i >= 0; i = NEXT_I(i,LAST_MOD3_LKC)) { + editaction = LYLineEditors[current_lineedit][i]; + if (!(editaction & LYE_DF)) + continue; + editaction = Mod3Binding[i]; +#ifdef NOT_ASCII + if (i < 256) { + c = FROMASCII(i); + } else +#endif + c = i; + if (pmodkey) + *pmodkey = c; + if (editaction == (lac | LYE_FORM_LAC)) + return (c|LKC_MOD3); + if (editaction == LYE_FORM_PASS) { +#if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) + if (lynx_edit_mode && !no_dired_support && lac && + LKC_TO_LAC(key_override,c) == lac) + return (c|LKC_MOD3); +#endif /* DIRED_SUPPORT && OK_OVERRIDE */ + if (LKC_TO_LAC(keymap,c) == lac) + return (c|LKC_MOD3); + } + if (editaction == LYE_TAB) { +#if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) + if (lynx_edit_mode && !no_dired_support && lac && + LKC_TO_LAC(key_override,'\t') == lac) + return (c|LKC_MOD3); +#endif /* DIRED_SUPPORT && OK_OVERRIDE */ + if (LKC_TO_LAC(keymap,'\t') == lac) + return (c|LKC_MOD3); + } + } + } + if (mod1found >= 0) { + if (pmodkey) { +#ifdef NOT_ASCII + if (mod1found < 256) { + pmodkey = FROMASCII(mod1found); + } else +#endif + *pmodkey = mod1found; + } + for (i = FIRST_I; i >= 0; i = NEXT_I(i,LAST_MOD1_LKC)) { + editaction = Mod1Binding[i]; +#ifdef NOT_ASCII + if (i < 256) { + c = FROMASCII(i); + } else +#endif + c = i; + if (editaction == (lac | LYE_FORM_LAC)) + return (c|LKC_MOD1); + if (editaction == LYE_FORM_PASS) { +#if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) + if (lynx_edit_mode && !no_dired_support && lac && + LKC_TO_LAC(key_override,c) == lac) + return (c|LKC_MOD1); +#endif /* DIRED_SUPPORT && OK_OVERRIDE */ + if (LKC_TO_LAC(keymap,c) == lac) + return (c|LKC_MOD1); + } + if (editaction == LYE_TAB) { +#if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) + if (lynx_edit_mode && !no_dired_support && lac && + LKC_TO_LAC(key_override,'\t') == lac) + return (c|LKC_MOD1); +#endif /* DIRED_SUPPORT && OK_OVERRIDE */ + if (LKC_TO_LAC(keymap,'\t') == lac) + return (c|LKC_MOD1); + } + } + } + if (mod2found >= 0) { + if (pmodkey) { +#ifdef NOT_ASCII + if (mod1found < 256) { + pmodkey = FROMASCII(mod1found); + } else +#endif + *pmodkey = mod1found; + } + for (i = FIRST_I; i >= 0; i = NEXT_I(i,LAST_MOD2_LKC)) { + editaction = Mod2Binding[i]; +#ifdef NOT_ASCII + if (i < 256) { + c = FROMASCII(i); + } else +#endif + c = i; + if (editaction == (lac | LYE_FORM_LAC)) + return (c|LKC_MOD2); + if (editaction == LYE_FORM_PASS) { +#if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) + if (lynx_edit_mode && !no_dired_support && lac && + LKC_TO_LAC(key_override,c) == lac) + return (c|LKC_MOD2); +#endif /* DIRED_SUPPORT && OK_OVERRIDE */ + if (LKC_TO_LAC(keymap,c) == lac) + return (c|LKC_MOD2); + } + if (editaction == LYE_TAB) { +#if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) + if (lynx_edit_mode && !no_dired_support && lac && + LKC_TO_LAC(key_override,'\t') == lac) + return (c|LKC_MOD2); +#endif /* DIRED_SUPPORT && OK_OVERRIDE */ + if (LKC_TO_LAC(keymap,'\t') == lac) + return (c|LKC_MOD2); + } + } + } + if (pmodkey) + *pmodkey = -1; + return (-1); +} + +/* * Dummy initializer to ensure this module is linked * if the external model is common block, and the * module is ever placed in a library. - FM */ -PUBLIC int LYEditmapDeclared NOPARAMS +PUBLIC int LYEditmapDeclared NOARGS { int status = 1; diff --git a/src/LYForms.c b/src/LYForms.c index 6e10025b..28660512 100644 --- a/src/LYForms.c +++ b/src/LYForms.c @@ -394,7 +394,7 @@ PRIVATE int form_getstr ARGS3( * If we can edit it, report that we are using the tail. - FM */ HTUserMsg(FORM_VALUE_TOO_LONG); - show_formlink_statusline(form); + show_formlink_statusline(form, FOR_INPUT); move(startline, startcol); } } @@ -1825,8 +1825,9 @@ restore_popup_statusline: /* * Display statusline info tailored for the current form field. */ -PUBLIC void show_formlink_statusline ARGS1( - CONST FormInfo *, form) +PUBLIC void show_formlink_statusline ARGS2( + CONST FormInfo *, form, + int, for_what) { switch(form->type) { case F_PASSWORD_TYPE: @@ -1865,7 +1866,17 @@ PUBLIC void show_formlink_statusline ARGS1( } else if (form->no_cache) { statusline(FORM_LINK_TEXT_RESUBMIT_MESSAGE); } else { - statusline(FORM_LINK_TEXT_SUBMIT_MESSAGE); + char *submit_str = NULL; + char *xkey_info = key_for_func_ext(LYK_NOCACHE, for_what); + if (xkey_info && *xkey_info) { + HTSprintf0(&submit_str, FORM_LINK_TEXT_SUBMIT_MESSAGE_X, + xkey_info); + statusline(submit_str); + FREE(submit_str); + } else { + statusline(FORM_LINK_TEXT_SUBMIT_MESSAGE); + } + FREE(xkey_info); } break; case F_SUBMIT_TYPE: @@ -1933,8 +1944,25 @@ PUBLIC void show_formlink_statusline ARGS1( case F_TEXTAREA_TYPE: if (form->disabled == YES) statusline(FORM_LINK_TEXT_UNM_MSG); - else + else if (no_editor || !editor || !*editor) { statusline(FORM_LINK_TEXTAREA_MESSAGE); + } else { + char *submit_str = NULL; + char *xkey_info = key_for_func_ext(LYK_EDIT_TEXTAREA, for_what); +#ifdef TEXTAREA_AUTOEXTEDIT + if (!xkey_info) + xkey_info = key_for_func_ext(LYK_DWIMEDIT, for_what); +#endif + if (xkey_info && *xkey_info) { + HTSprintf0(&submit_str, FORM_LINK_TEXTAREA_MESSAGE_E, + xkey_info); + statusline(submit_str); + FREE(submit_str); + } else { + statusline(FORM_LINK_TEXTAREA_MESSAGE); + } + FREE(xkey_info); + } break; } } diff --git a/src/LYGetFile.c b/src/LYGetFile.c index 9a80861c..8649a7c5 100644 --- a/src/LYGetFile.c +++ b/src/LYGetFile.c @@ -385,25 +385,44 @@ Try_Redirected_URL: #endif /* DIRED_SUPPORT */ } + if (LYNoRefererHeader == FALSE && LYNoRefererForThis == FALSE) { + char *ref_url = HTLoadedDocumentURL(); + if (!strncmp(ref_url, "LYNXIMGMAP:", 11)) + ref_url += 11; if (no_filereferer == TRUE && - !strncmp(HTLoadedDocumentURL(), "file:", 5)) { + !strncmp(ref_url, "file:", 5)) { LYNoRefererForThis = TRUE; } if (LYNoRefererForThis == FALSE && - (cp = strchr(HTLoadedDocumentURL(), '?')) != NULL && - strchr(cp, '=') != NULL) { + (cp = strchr(ref_url, '?')) != NULL && + strchr(cp, '=') != NULL) { /* * Don't send a Referer header if the URL is * the reply from a form with method GET, in * case the content has personal data (e.g., * a password or credit card number) which * would become visible in logs. - FM + * + * Changed 1999-11-01 to be controlled by + * REFERER_WITH_QUERY option. - kw */ - LYNoRefererForThis = TRUE; + if (LYRefererWithQuery == 'S') { /* SEND */ + StrAllocCopy(LYRequestReferer, ref_url); + } else if (LYRefererWithQuery == 'P') { /* PARTIAL */ + FREE(LYRequestReferer); /* just to be sure */ + LYRequestReferer = HTParse(ref_url, "", + PARSE_ACCESS|PARSE_HOST|PARSE_STRICTPATH|PARSE_PUNCTUATION); + } else { /* Everyhting else - don't send Referer */ + LYNoRefererForThis = TRUE; + } cp = NULL; + } else if (LYNoRefererForThis == FALSE) { + StrAllocCopy(LYRequestReferer, ref_url); } + } else { + StrAllocCopy(LYRequestReferer, HTLoadedDocumentURL()); } if (url_type == LYNXHIST_URL_TYPE) { /* diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index dc41af94..7046395d 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -154,6 +154,7 @@ extern BOOLEAN telnet_ok; extern BOOLEAN verbose_img; /* display filenames of images? */ extern BOOLEAN vi_keys; /* TRUE to turn on vi-like key movement */ extern char *LYRequestTitle; /* newdoc.title in calls to getfile() */ +extern char *LYRequestReferer; /* Referer, may be set in getfile() */ extern char *LynxHome; extern char *LynxSigFile; /* Signature file, in or off home */ extern char *checked_box; /* form boxes */ @@ -244,6 +245,7 @@ extern BOOLEAN no_compileopts_info; extern BOOLEAN no_statusline; extern BOOLEAN no_filereferer; +extern char LYRefererWithQuery; /* 'S', 'P', or 'D' */ extern BOOLEAN local_host_only; extern BOOLEAN override_no_download; extern BOOLEAN show_dotfiles; /* From rcfile if no_dotfiles is false */ @@ -290,6 +292,10 @@ 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 search_target[512]; /* user search string: * + * used by highlight() 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 */ @@ -334,7 +340,7 @@ extern char *URLDomainSuffixes; extern BOOLEAN startfile_ok; extern BOOLEAN LYSelectPopups; /* Cast popups to radio buttons? */ extern BOOLEAN LYUseDefSelPop; /* Command line -popup toggle */ -extern BOOLEAN LYMultiBookmarks; /* Multi bookmark support on? */ +extern BOOLEAN LYMultiBookmarks; /* Multi bookmark support on? */ extern BOOLEAN LYMBMBlocked; /* Force MBM support off? */ extern BOOLEAN LYMBMAdvanced; /* MBM statusline for ADVANCED? */ extern int LYStatusLine; /* Line for statusline() or -1 */ diff --git a/src/LYHistory.c b/src/LYHistory.c index 9f7a8cca..f405d720 100644 --- a/src/LYHistory.c +++ b/src/LYHistory.c @@ -25,6 +25,14 @@ #include <LYLeaks.h> PUBLIC HTList * Visited_Links = NULL; /* List of safe popped docs. */ +PUBLIC int Visited_Links_As = VISITED_LINKS_AS_TREE; +PRIVATE VisitedLink *PrevVisitedLink = NULL; /* NULL on auxillary */ +PRIVATE VisitedLink *PrevActiveVisitedLink = NULL; /* Last non-auxillary */ +PRIVATE VisitedLink Latest_first; +PRIVATE VisitedLink Latest_last; +PRIVATE VisitedLink *Latest_tree; +PRIVATE VisitedLink *First_tree; +PRIVATE VisitedLink *Last_by_first; #ifdef LY_FIND_LEAKS /* @@ -35,6 +43,8 @@ PRIVATE void Visited_Links_free NOARGS VisitedLink *vl; HTList *cur = Visited_Links; + PrevVisitedLink = NULL; + PrevActiveVisitedLink = NULL; if (!cur) return; @@ -45,6 +55,9 @@ PRIVATE void Visited_Links_free NOARGS } HTList_delete(Visited_Links); Visited_Links = NULL; + Latest_last.prev_latest = &Latest_first; + Latest_first.next_latest = &Latest_last; + Last_by_first = Latest_tree = First_tree = 0; return; } #endif /* LY_FIND_LEAKS */ @@ -57,11 +70,13 @@ PUBLIC void LYAddVisitedLink ARGS1( document *, doc) { VisitedLink *new; - VisitedLink *old; HTList *cur; + char *title = (doc->title ? doc->title : NO_TITLE); - if (!(doc->address && *doc->address)) + if (!(doc->address && *doc->address)) { + PrevVisitedLink = NULL; return; + } /* * Exclude POST or HEAD replies, and bookmark, menu @@ -70,61 +85,115 @@ PUBLIC void LYAddVisitedLink ARGS1( if (doc->post_data || doc->isHEAD || doc->bookmark || (/* special url or a temp file */ (!strncmp(doc->address, "LYNX", 4) || - !strncmp(doc->address, "file://localhost/", 17)) - && ( - !strcmp((doc->title ? doc->title : ""), HISTORY_PAGE_TITLE) || - !strcmp((doc->title ? doc->title : ""), PRINT_OPTIONS_TITLE) || - !strcmp((doc->title ? doc->title : ""), DOWNLOAD_OPTIONS_TITLE) || - !strcmp((doc->title ? doc->title : ""), OPTIONS_TITLE) || + !strncmp(doc->address, "file://localhost/", 17)))) { + int related = 1; /* First approximation only */ + + if ( !strcmp(title, HISTORY_PAGE_TITLE) || + !strcmp(title, VISITED_LINKS_TITLE) || + !strcmp(title, SHOWINFO_TITLE) || + !strcmp(title, STATUSLINES_TITLE) || + (related = 0) || #ifdef DIRED_SUPPORT - !strcmp((doc->title ? doc->title : ""), DIRED_MENU_TITLE) || - !strcmp((doc->title ? doc->title : ""), UPLOAD_OPTIONS_TITLE) || - !strcmp((doc->title ? doc->title : ""), PERMIT_OPTIONS_TITLE) || + !strcmp(title, DIRED_MENU_TITLE) || + !strcmp(title, UPLOAD_OPTIONS_TITLE) || + !strcmp(title, PERMIT_OPTIONS_TITLE) || #endif /* DIRED_SUPPORT */ - !strcmp((doc->title ? doc->title : ""), CURRENT_KEYMAP_TITLE) || - !strcmp((doc->title ? doc->title : ""), LIST_PAGE_TITLE) || + !strcmp(title, PRINT_OPTIONS_TITLE) || + !strcmp(title, DOWNLOAD_OPTIONS_TITLE) || + !strcmp(title, OPTIONS_TITLE) || + !strcmp(title, CURRENT_KEYMAP_TITLE) || + !strcmp(title, LIST_PAGE_TITLE) || #ifdef EXP_ADDRLIST_PAGE - !strcmp((doc->title ? doc->title : ""), ADDRLIST_PAGE_TITLE) || + !strcmp(title, ADDRLIST_PAGE_TITLE) || #endif - !strcmp((doc->title ? doc->title : ""), SHOWINFO_TITLE) || - !strcmp((doc->title ? doc->title : ""), STATUSLINES_TITLE) || - !strcmp((doc->title ? doc->title : ""), CONFIG_DEF_TITLE) || - !strcmp((doc->title ? doc->title : ""), LYNXCFG_TITLE) || - !strcmp((doc->title ? doc->title : ""), COOKIE_JAR_TITLE) || - !strcmp((doc->title ? doc->title : ""), VISITED_LINKS_TITLE) || - !strcmp((doc->title ? doc->title : ""), LYNX_TRACELOG_TITLE)))) { - return; + !strcmp(title, CONFIG_DEF_TITLE) || + !strcmp(title, LYNXCFG_TITLE) || + !strcmp(title, COOKIE_JAR_TITLE) || + !strcmp(title, LYNX_TRACELOG_TITLE) ) { + if (!related) + PrevVisitedLink = NULL; + return; + } } - if ((new = (VisitedLink *)calloc(1, sizeof(*new))) == NULL) - outofmem(__FILE__, "LYAddVisitedLink"); - StrAllocCopy(new->address, doc->address); - StrAllocCopy(new->title, (doc->title ? doc->title : NO_TITLE)); - if (!Visited_Links) { Visited_Links = HTList_new(); #ifdef LY_FIND_LEAKS atexit(Visited_Links_free); #endif - HTList_addObject(Visited_Links, new); - return; + Latest_last.prev_latest = &Latest_first; + Latest_first.next_latest = &Latest_last; + Latest_last.next_latest = NULL; /* Find bugs quick! */ + Latest_first.prev_latest = NULL; + Last_by_first = Latest_tree = First_tree = NULL; } cur = Visited_Links; - while (NULL != (old = (VisitedLink *)HTList_nextObject(cur))) { - if (!strcmp((old->address ? old->address : ""), - (new->address ? new->address : ""))) { - if (!(new->title && *new->title) && old->title) { - StrAllocCopy(new->title, old->title); - } - FREE(old->address); - FREE(old->title); - HTList_removeObject(Visited_Links, old); - FREE(old); - break; + while (NULL != (new = (VisitedLink *)HTList_nextObject(cur))) { + if (!strcmp((new->address ? new->address : ""), + (doc->address ? doc->address : ""))) { + PrevVisitedLink = PrevActiveVisitedLink = new; + /* Already visited. Update the last-visited info. */ + if (new->next_latest == &Latest_last) /* optimization */ + return; + + /* Remove from "latest" chain */ + new->prev_latest->next_latest = new->next_latest; + new->next_latest->prev_latest = new->prev_latest; + + /* Insert at the end of the "latest" chain */ + Latest_last.prev_latest->next_latest = new; + new->prev_latest = Latest_last.prev_latest; + new->next_latest = &Latest_last; + Latest_last.prev_latest = new; + return; } } - HTList_addObject(Visited_Links, new); + + if ((new = (VisitedLink *)calloc(1, sizeof(*new))) == NULL) + outofmem(__FILE__, "LYAddVisitedLink"); + StrAllocCopy(new->address, doc->address); + StrAllocCopy(new->title, title); + + /* First-visited chain */ + HTList_appendObject(Visited_Links, new); /* At end */ + new->prev_first = Last_by_first; + Last_by_first = new; + + /* Tree structure */ + if (PrevVisitedLink) { + VisitedLink *a = PrevVisitedLink; + VisitedLink *b = a->next_tree; + int l = PrevVisitedLink->level; + + /* Find last on the deeper levels */ + while (b && b->level > l) + a = b, b = b->next_tree; + + if (a->next_tree) + a->next_tree->prev_tree = new; + new->prev_tree = a; + new->next_tree = a->next_tree; + a->next_tree = new; + + new->level = PrevVisitedLink->level + 1; + } else { + if (Latest_tree) + Latest_tree->next_tree = new; + new->prev_tree = Latest_tree; + new->level = 0; + new->next_tree = NULL; + } + PrevVisitedLink = PrevActiveVisitedLink = new; + Latest_tree = new; + if (!First_tree) + First_tree = new; + + /* "latest" chain */ + Latest_last.prev_latest->next_latest = new; + new->prev_latest = Latest_last.prev_latest; + new->next_latest = &Latest_last; + Latest_last.prev_latest = new; return; } @@ -560,8 +629,8 @@ PUBLIC BOOLEAN historytarget ARGS1( } /* - * This procedure outputs the Visited Links - * list into a temporary file. - FM + * This procedure outputs the Visited Links list into a temporary file. - FM + * Returns links's number to make active (1-based), or 0 if not required. */ PUBLIC int LYShowVisitedLinks ARGS1( char **, newfile) @@ -569,10 +638,13 @@ PUBLIC int LYShowVisitedLinks ARGS1( static char tempfile[LY_MAXPATH] = "\0"; char *Title = NULL; char *Address = NULL; - int x; + int x, tot; FILE *fp0; VisitedLink *vl; HTList *cur = Visited_Links; + int offset; + int ret = 0; + char *arrow, *post_arrow; if (!cur) return(-1); @@ -595,16 +667,78 @@ PUBLIC int LYShowVisitedLinks ARGS1( BeginInternalPage(fp0, VISITED_LINKS_TITLE, VISITED_LINKS_HELP); + fprintf(fp0, "<form action=\"LYNXOPTIONS:\" method=\"post\">\n"); + fprintf(fp0, "<select name=\"visited_pages_type\">\n"); + fprintf(fp0, " <option value=\"first_visited\" %s>Sort By First Visited\n", + (Visited_Links_As == VISITED_LINKS_AS_FIRST_V ? "selected" : "")); + fprintf(fp0, " <option value=\"first_visited_reversed\" %s>Reverse Sort By First Visited\n", + (Visited_Links_As == (VISITED_LINKS_AS_FIRST_V|VISITED_LINKS_REVERSE) ? "selected" : "")); + fprintf(fp0, " <option value=\"visit_tree\" %s>View As Visit Tree\n", + (Visited_Links_As == VISITED_LINKS_AS_TREE ? "selected" : "")); + fprintf(fp0, " <option value=\"last_visited\" %s>Sort By Last Visited\n", + (Visited_Links_As == VISITED_LINKS_AS_LATEST ? "selected" : "")); + fprintf(fp0, " <option value=\"last_visited_reversed\" %s>Reverse Sort By Last Visited\n", + (Visited_Links_As == (VISITED_LINKS_AS_LATEST|VISITED_LINKS_REVERSE) + ? "selected" : "")); + fprintf(fp0, "</select>\n"); + fprintf(fp0, "<input type=\"submit\" value=\"Accept Changes\">\n"); + fprintf(fp0, "</form>\n"); + fprintf(fp0, "<P>\n"); + fprintf(fp0, "<pre>\n"); fprintf(fp0, "<em>%s</em>\n", gettext("You visited (POSTs, bookmark, menu and list files excluded):")); - x = HTList_count(Visited_Links); - while (NULL != (vl = (VisitedLink *)HTList_nextObject(cur))) { + if (Visited_Links_As & VISITED_LINKS_REVERSE) + tot = x = HTList_count(Visited_Links); + else + tot = x = -1; + + if (Visited_Links_As & VISITED_LINKS_AS_TREE) { + vl = First_tree; + } else if (Visited_Links_As & VISITED_LINKS_AS_LATEST) { + if (Visited_Links_As & VISITED_LINKS_REVERSE) + vl = Latest_last.prev_latest; + else + vl = Latest_first.next_latest; + if (vl == &Latest_last || vl == &Latest_first) + vl = NULL; + } else { + if (Visited_Links_As & VISITED_LINKS_REVERSE) + vl = Last_by_first; + else + vl = (VisitedLink *)HTList_nextObject(cur); + } + while (NULL != vl) { /* * The number of the document (most recent highest), * its title in a link, and its address. - FM */ - x--; + post_arrow = arrow = ""; + if (Visited_Links_As & VISITED_LINKS_REVERSE) + x--; + else + x++; + if (vl == PrevActiveVisitedLink) { + if (Visited_Links_As & VISITED_LINKS_REVERSE) + ret = tot - x + 2; + else + ret = x + 3; + } + if (vl == PrevActiveVisitedLink) { + post_arrow = "<A NAME=current></A>"; + /* Otherwise levels 0 and 1 look the same when with arrow: */ + arrow = (vl->level && (Visited_Links_As & VISITED_LINKS_AS_TREE)) + ? "==>" : "=>"; + StrAllocCat(*newfile, "#current"); + } + if (Visited_Links_As & VISITED_LINKS_AS_TREE) { + offset = 2 * vl->level; + if (offset > 24) + offset = (offset + 24)/2; + if (offset > LYcols * 3/4) + offset = LYcols * 3/4; + } else + offset = (x > 99 ? 0 : x < 10 ? 2 : 1); if (vl->title != NULL && *vl->title != '\0') { StrAllocCopy(Title, vl->title); LYEntify(&Title, TRUE); @@ -619,13 +753,13 @@ PUBLIC int LYShowVisitedLinks ARGS1( StrAllocCopy(Address, vl->address); LYEntify(&Address, FALSE); fprintf(fp0, - "%s<em>%d</em>. <tab id=t%d><a href=\"%s\">%s</a>\n", - (x > 99 ? "" : x < 10 ? " " : " "), + "%-*s%s<em>%d</em>. <tab id=t%d><a href=\"%s\">%s</a>\n", + offset, arrow, post_arrow, x, x, Address, Title); } else { fprintf(fp0, - "%s<em>%d</em>. <tab id=t%d><em>%s</em>\n", - (x > 99 ? "" : x < 10 ? " " : " "), + "%-*s%s<em>%d</em>. <tab id=t%d><em>%s</em>\n", + offset, arrow, post_arrow, x, x, Title); } if (Address != NULL) { @@ -634,6 +768,21 @@ PUBLIC int LYShowVisitedLinks ARGS1( } fprintf(fp0, "<tab to=t%d>%s\n", x, ((Address != NULL) ? Address : gettext("(no address)"))); + if (Visited_Links_As & VISITED_LINKS_AS_TREE) + vl = vl->next_tree; + else if (Visited_Links_As & VISITED_LINKS_AS_LATEST) { + if (Visited_Links_As & VISITED_LINKS_REVERSE) + vl = vl->prev_latest; + else + vl = vl->next_latest; + if (vl == &Latest_last || vl == &Latest_first) + vl = NULL; + } else { + if (Visited_Links_As & VISITED_LINKS_REVERSE) + vl = vl->prev_first; + else + vl = (VisitedLink *)HTList_nextObject(cur); + } } fprintf(fp0,"</pre>\n"); EndInternalPage(fp0); @@ -641,7 +790,7 @@ PUBLIC int LYShowVisitedLinks ARGS1( LYCloseTempFP(fp0); FREE(Title); FREE(Address); - return(0); + return(ret); } diff --git a/src/LYKeymap.c b/src/LYKeymap.c index bd5783b5..47e45e10 100644 --- a/src/LYKeymap.c +++ b/src/LYKeymap.c @@ -782,6 +782,39 @@ PRIVATE char *pretty ARGS1 (int, c) static char buf[30]; if (c == '\t') + sprintf(buf, "<tab>"); + else if (c == '\r') + sprintf(buf, "<return>"); + else if (c == CH_ESC) + sprintf(buf, "ESC"); + else if (c == ' ') + sprintf(buf, "<space>"); + else if (c == '<') + sprintf(buf, "<"); + else if (c == '>') + sprintf(buf, ">"); + else if (c == 0177) + sprintf(buf, "<delete>"); + else if (c > ' ' && c <= 0377) + sprintf(buf, "%c", c); + else if (c < ' ') + sprintf(buf, "^%c", c|0100); + else if (c >= 0400 && (c - 0400) < (int) TABLESIZE(funckey) + && funckey[c-0400]) + sprintf(buf, "%s", funckey[c-0400]); + else if (c >= 0400) + sprintf(buf, "key-%#x", c); + else + return 0; + + return buf; +} + +PRIVATE char *pretty_html ARGS1 (int, c) +{ + static char buf[30]; + + if (c == '\t') sprintf(buf, "<tab> "); else if (c == '\r') sprintf(buf, "<return> "); @@ -820,7 +853,7 @@ PRIVATE char * format_binding ARGS2( && the_key < TABLESIZE(revmap) && revmap[the_key].name != 0 && revmap[the_key].doc != 0 - && (formatted = pretty(i-1)) != 0) { + && (formatted = pretty_html(i-1)) != 0) { HTSprintf0(&buf, "%-11s %-13s %s\n", formatted, revmap[the_key].name, revmap[the_key].doc); @@ -996,7 +1029,7 @@ PUBLIC int remap ARGS2( else if (c >= 0) { /* Remapping of key actions is supported only for basic * lynxkeycodes, without modifiers etc.! If we get somehow - * called for an invalid lynxkeycode, fail or silently + * called for an invalid lynxkeycode, fail or silently ignore * modifiers. - kw */ if (c & LKC_ISLAC) @@ -1166,6 +1199,122 @@ PUBLIC char *key_for_func ARGS1 ( } /* + * Given one or two keys as lynxkeycodes, returns an allocated string + * representing the key(s) suitable for statusline messages. + * The caller must free the string. - kw + */ +PRIVATE char *fmt_keys ARGS2( + int, lkc_first, + int, lkc_second) +{ + char *buf = NULL; + BOOLEAN quotes = FALSE; + char *fmt_first = pretty(lkc_first); + char *fmt_second; + if (fmt_first && strlen(fmt_first) == 1 && *fmt_first != '\'') { + quotes = TRUE; + } + if (quotes) { + if (lkc_second < 0) { + HTSprintf0(&buf, "'%s'", fmt_first); + return buf; + } else { + HTSprintf0(&buf, "'%s", fmt_first); + } + } else { + StrAllocCopy(buf, fmt_first); + } + if (lkc_second >= 0) { + fmt_second = pretty(lkc_second); + if (!fmt_second) { + FREE(buf); + return NULL; + } + HTSprintf(&buf, "%s%s%s", + ((strlen(fmt_second) > 2 && *fmt_second != '<') || + (strlen(buf) > 2 && buf[strlen(buf)-1] != '>')) ? " " : "", + fmt_second, quotes ? "'" : ""); + } + return buf; +} + +/* + * This function returns the (int)ch mapped to the + * LYK_foo value passed to it as an argument. It is like + * LYReverseKeymap, only the order of search is different; + * e.g., small ASCII letters will be returned in preference to + * capital ones. Cf. LYKeyForEditAction, LYEditKeyForAction in + * LYEditmap.c which use the same order to find a best key. + * In addition, this function takes the dired override map into + * account while LYReverseKeymap doesn't. + * The caller must free the returned string. - kw + */ +#define FIRST_I 97 +#define NEXT_I(i,imax) ((i==122) ? 32 : (i==96) ? 123 : (i==126) ? 0 :\ + (i==31) ? 256 : (i==imax) ? 127 :\ + (i==255) ? (-1) :i+1) +PRIVATE int best_reverse_keymap ARGS1( + int, lac) +{ + int i, c; + + for (i = FIRST_I; i >= 0; i = NEXT_I(i,KEYMAP_SIZE-2)) { +#ifdef NOT_ASCII + if (i < 256) { + c = FROMASCII(i); + } else +#endif + c = i; +#if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) + if (lynx_edit_mode && !no_dired_support && lac && + LKC_TO_LAC(key_override,c) == lac) + return c; +#endif /* DIRED_SUPPORT && OK_OVERRIDE */ + if (LKC_TO_LAC(keymap,c) == lac) { + return c; + } + } + + return(-1); +} + +/* + * This function returns a string representing a key mapped + * to a LYK_foo function, or NULL if not found. The string + * may represent a pair of keys. if context_code is FOR_INPUT, + * an appropriate binding for use while in the (forms) line editor + * is sought. - kw + */ +PUBLIC char* key_for_func_ext ARGS2( + int, lac, + int, context_code) +{ + int lkc, modkey = -1; + + if (context_code == FOR_INPUT) { + lkc = LYEditKeyForAction(lac, &modkey); + if (lkc >= 0) { + if (lkc & (LKC_MOD1|LKC_MOD2|LKC_MOD3)) { + return fmt_keys(modkey, lkc & ~(LKC_MOD1|LKC_MOD2|LKC_MOD3)); + } else { + return fmt_keys(lkc, -1); + } + } + } + lkc = best_reverse_keymap(lac); + if (lkc < 0) + return NULL; + if (context_code == FOR_INPUT) { + modkey = LYKeyForEditAction(LYE_LKCMD); + if (modkey < 0) + return NULL; + return fmt_keys(modkey, lkc); + } else { + return fmt_keys(lkc, -1); + } +} + +/* * This function returns TRUE if the ch is non-alphanumeric * and maps to KeyName (LYK_foo in the keymap[] array). - FM */ diff --git a/src/LYKeymap.h b/src/LYKeymap.h index 85ffb087..60d640b7 100644 --- a/src/LYKeymap.h +++ b/src/LYKeymap.h @@ -7,10 +7,11 @@ extern BOOLEAN LYisNonAlnumKeyname PARAMS((int ch, int KeyName)); extern char *key_for_func PARAMS((int func)); +extern char *key_for_func_ext PARAMS((int lac, int context_code)); extern int LYReverseKeymap PARAMS((int KeyName)); -extern int lookup_keymap PARAMS((int code)); extern int lacname_to_lac PARAMS((CONST char *func)); extern int lkcstring_to_lkc PARAMS((CONST char *src)); +extern int lookup_keymap PARAMS((int code)); extern int remap PARAMS((char *key, char *func)); extern void print_keymap PARAMS((char **newfile)); extern void reset_emacs_keys NOPARAMS; diff --git a/src/LYMain.c b/src/LYMain.c index 8c06d910..98e6fbbd 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -266,6 +266,7 @@ PUBLIC BOOLEAN no_compileopts_info = FALSE; PUBLIC BOOLEAN no_statusline = FALSE; PUBLIC BOOLEAN no_filereferer = FALSE; +PUBLIC char LYRefererWithQuery = 'D'; /* 'D' for drop */ PUBLIC BOOLEAN local_host_only = FALSE; PUBLIC BOOLEAN override_no_download = FALSE; PUBLIC BOOLEAN show_dotfiles = FALSE; /* From rcfile if no_dotfiles is false */ @@ -408,7 +409,7 @@ PUBLIC char *LYCookieSStrictCheckDomains = NULL; /* check strictly */ PUBLIC char *LYCookieSLooseCheckDomains = NULL; /* check loosely */ PUBLIC char *LYCookieSQueryCheckDomains = NULL; /* check w/a query */ #ifdef EXP_PERSISTENT_COOKIES -BOOLEAN persistent_cookies = TRUE; +BOOLEAN persistent_cookies = FALSE; /* disabled by default! */ PUBLIC char *LYCookieFile = NULL; /* default cookie file */ #endif /* EXP_PERSISTENT_COOKIES */ PUBLIC char *XLoadImageCommand = NULL; /* Default image viewer for X */ @@ -1370,7 +1371,7 @@ PUBLIC int main ARGS2( if ((lynx_cfg_file[0] == '~') && LYIsPathSep(lynx_cfg_file[1])) { #ifdef VMS - StrAllocCopy(temp, HTVMS_wwwName((char *)Home_Dir())); + StrAllocCopy(temp, HTVMS_wwwName(Home_Dir())); #else StrAllocCopy(temp, Home_Dir()); #endif /* VMS */ @@ -1455,7 +1456,7 @@ PUBLIC int main ARGS2( StrAllocCopy(temp, lynx_lss_file); LYTrimPathSep(temp); #ifdef VMS - StrAllocCat(temp, HTVMS_wwwName((char *)Home_Dir())); + StrAllocCat(temp, HTVMS_wwwName(Home_Dir())); #else StrAllocCat(temp, Home_Dir()); #endif /* VMS */ @@ -2979,7 +2980,7 @@ static Parse_Args_Type Arg_Table [] = { PARSE_SET( "accept_all_cookies", SET_ARG, &LYAcceptAllCookies, - "\naccepts all cookies" + "\naccept cookies without prompting if Set-Cookie handling is on" ), PARSE_FUN( "anonymous", FUNCTION_ARG, anonymous_fun, diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index 157fe2a7..96306ab5 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -169,7 +169,7 @@ PRIVATE int str_n_cmp(const char *p, const char *q, int n) PRIVATE void exit_immediately_with_error_message PARAMS((int state, BOOLEAN first_file)); PRIVATE void status_link PARAMS((char *curlink_name, BOOLEAN show_more, BOOLEAN show_indx)); -PRIVATE void show_main_statusline PARAMS((CONST linkstruct curlink)); +PRIVATE void show_main_statusline PARAMS((CONST linkstruct curlink, int for_what)); PRIVATE BOOL confirm_post_resub PARAMS(( CONST char* address, CONST char* title, @@ -195,6 +195,9 @@ PRIVATE int sametext ARGS2( PUBLIC HTList * Goto_URLs = NULL; /* List of Goto URLs */ PUBLIC char * LYRequestTitle = NULL; /* newdoc.title in calls to getfile() */ +PUBLIC char * LYRequestReferer = NULL; /* Referer, may be set in getfile() */ + +PUBLIC char search_target[512]; /* now global */ #ifdef DISP_PARTIAL PUBLIC int Newline_partial = 0; /* required for display_partial mode */ @@ -246,6 +249,7 @@ PRIVATE void free_mainloop_variables NOARGS clear_tags(); #endif /* DIRED_SUPPORT */ FREE(WWW_Download_File); /* LYGetFile.c/HTFWriter.c */ + FREE(LYRequestReferer); return; } @@ -355,8 +359,7 @@ PRIVATE BOOLEAN LYReopenTracelog ARGS1(BOOLEAN *, trace_flag_ptr) 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 +367,7 @@ PRIVATE int do_change_link ARGS1( 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 +862,9 @@ PRIVATE BOOLEAN check_history NOARGS } #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, @@ -879,11 +881,11 @@ PRIVATE int handle_LYK_ACTIVATE ARGS7( textinput_activated = TRUE; textinput_drawn = FALSE; if (!sticky_inputs) - show_main_statusline(links[curdoc.link]); + show_main_statusline(links[curdoc.link], FOR_INPUT); 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 */ @@ -1040,7 +1042,12 @@ gettext("Enctype multipart/form-data not yet supported! Cannot submit.")); links[curdoc.link].form->type == F_TEXT_SUBMIT_TYPE || links[curdoc.link].form->type == F_PASSWORD_TYPE || links[curdoc.link].form->type == F_TEXTAREA_TYPE) { - show_formlink_statusline(links[curdoc.link].form); + show_formlink_statusline(links[curdoc.link].form, + (real_cmd==LYK_SUBMIT || + real_cmd==LYK_NOCACHE || + real_cmd==LYK_DOWNLOAD || + real_cmd==LYK_HEAD) ? + FOR_PANEL : FOR_INPUT); } *c = change_form_link(&links[curdoc.link], @@ -1854,9 +1861,6 @@ PRIVATE void handle_LYK_DIRED_MENU ARGS3( /* * Don't do if not allowed or already viewing the menu. */ -#ifdef __DJGPP__ - lynx_edit_mode = TRUE; -#endif /* __DJGPP__ */ if (lynx_edit_mode && !no_dired_support && strcmp(curdoc.address, LYDiredFileURL) && strcmp((curdoc.title ? curdoc.title : ""), @@ -1868,8 +1872,7 @@ PRIVATE void handle_LYK_DIRED_MENU ARGS3( #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 +1897,7 @@ PRIVATE int handle_LYK_DOWNLOAD ARGS4( 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 +2118,7 @@ PRIVATE void handle_LYK_DOWN_HALF ARGS2( } } -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 +2135,7 @@ PRIVATE void handle_LYK_DOWN_LINK ARGS4( 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); @@ -2176,7 +2178,7 @@ PRIVATE int handle_LYK_DWIMEDIT ARGS3( int *, old_c, int, real_c) { -#ifdef AUTOEXTEDIT +#ifdef TEXTAREA_AUTOEXTEDIT /* * If we're in a forms TEXTAREA, invoke the editor on *its* * contents, rather than attempting to edit the html source @@ -2212,7 +2214,7 @@ PRIVATE int handle_LYK_DWIMEDIT ARGS3( } return 1; } -#endif /* AUTOEXTEDIT */ +#endif /* TEXTAREA_AUTOEXTEDIT */ return 0; } @@ -2570,9 +2572,8 @@ PRIVATE void handle_LYK_EXTERN ARGS1( } #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 +2654,7 @@ PRIVATE BOOLEAN handle_LYK_FASTBACKW_LINK ARGS4( nextlink--; } } - highlight(OFF, curdoc.link, prev_target); + highlight(OFF, curdoc.link); curdoc.link = nextlink; return FALSE; /* and we are done. */ @@ -2681,8 +2682,7 @@ PRIVATE BOOLEAN handle_LYK_FASTBACKW_LINK ARGS4( 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 +2724,7 @@ PRIVATE void handle_LYK_FASTFORW_LINK ARGS3( } } if (samepage) { - highlight(OFF, curdoc.link, prev_target); + highlight(OFF, curdoc.link); curdoc.link = nextlink; return; /* and we are done. */ @@ -2733,7 +2733,7 @@ PRIVATE void handle_LYK_FASTFORW_LINK ARGS3( * 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 */ @@ -3148,6 +3148,7 @@ PRIVATE void handle_LYK_INDEX_SEARCH ARGS4( */ StrAllocCopy(curdoc.address, newdoc.address); StrAllocCopy(newdoc.post_data, curdoc.post_data); + StrAllocCopy(newdoc.post_content_type, curdoc.post_content_type); newdoc.internal_link = FALSE; curdoc.line = -1; Newline = 0; @@ -3189,8 +3190,7 @@ PRIVATE void handle_LYK_INDEX_SEARCH ARGS4( } } -PRIVATE BOOLEAN handle_LYK_INFO ARGS2( - char *, prev_target, +PRIVATE BOOLEAN handle_LYK_INFO ARGS1( int *, cmd) { /* @@ -3198,7 +3198,7 @@ PRIVATE BOOLEAN handle_LYK_INFO ARGS2( */ 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 +3418,11 @@ PRIVATE void handle_LYK_KEYMAP ARGS4( } } -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 +3462,7 @@ PRIVATE BOOLEAN handle_LYK_LIST ARGS1( 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 +3480,7 @@ PRIVATE void handle_LYK_MAIN_MENU ARGS3( 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 +3731,13 @@ PRIVATE BOOLEAN handle_LYK_OPTIONS ARGS2( 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 +3765,7 @@ PRIVATE void handle_LYK_NEXT_LINK ARGS4( * 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 +3777,14 @@ PRIVATE void handle_LYK_NEXT_LINK ARGS4( } } -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 +3814,7 @@ PRIVATE BOOLEAN handle_LYK_NOCACHE ARGS2( 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 +3823,7 @@ PRIVATE void handle_LYK_PREV_LINK ARGS4( /* * Unhighlight current link. */ - highlight(OFF, curdoc.link, prev_target); + highlight(OFF, curdoc.link); curdoc.link--; } else if (!more && @@ -3839,7 +3834,7 @@ PRIVATE void handle_LYK_PREV_LINK ARGS4( * 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 +3970,14 @@ PRIVATE int handle_PREV_DOC ARGS3( 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 +4136,11 @@ PRIVATE void handle_LYK_REMOVE NOARGS } #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 +4331,7 @@ PRIVATE void handle_LYK_SWITCH_DTD NOARGS } #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 +4368,10 @@ PRIVATE void handle_LYK_TAG_LINK ARGS1( } } 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 +4468,7 @@ PRIVATE void handle_LYK_TRACE_LOG ARGS1( 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 +4532,7 @@ PRIVATE void handle_LYK_UP_HALF ARGS3( } } -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 +4554,7 @@ PRIVATE void handle_LYK_UP_LINK ARGS5( 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; @@ -4664,9 +4655,12 @@ PRIVATE void handle_LYK_VIEW_BOOKMARK ARGS3( } } -PRIVATE BOOLEAN handle_LYK_VLINKS ARGS1( - int *, cmd) +PRIVATE BOOLEAN handle_LYK_VLINKS ARGS2( + int *, cmd, + BOOLEAN *, newdoc_link_is_absolute) { + int c; + if (!strcmp((curdoc.title ? curdoc.title : ""), VISITED_LINKS_TITLE)) { /* @@ -4679,7 +4673,8 @@ PRIVATE BOOLEAN handle_LYK_VLINKS ARGS1( /* * Print visited links page to file. */ - if (LYShowVisitedLinks(&newdoc.address) < 0) { + c = LYShowVisitedLinks(&newdoc.address); + if (c < 0) { HTUserMsg(VISITED_LINKS_EMPTY); return FALSE; } @@ -4690,6 +4685,11 @@ PRIVATE BOOLEAN handle_LYK_VLINKS ARGS1( newdoc.isHEAD = FALSE; newdoc.safe = FALSE; newdoc.internal_link = FALSE; + if (c > 0) { + /* Select a correct link. */ + *newdoc_link_is_absolute = TRUE; + newdoc.link = c - 1; + } if (LYValidate || check_realm) { LYPermitURL = TRUE; StrAllocCopy(lynxlinksfile, newdoc.address); @@ -4697,42 +4697,41 @@ PRIVATE BOOLEAN handle_LYK_VLINKS ARGS1( 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 +4755,9 @@ PRIVATE void handle_LYK_WHEREIS ARGS3( 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 +4767,10 @@ PRIVATE void handle_LYK_WHEREIS ARGS3( /* * 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 +4823,7 @@ PRIVATE void handle_LYK_digit ARGS7( 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 +4909,7 @@ PRIVATE void handle_LYK_digit ARGS7( * 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 +4975,6 @@ int mainloop NOARGS 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; @@ -5000,6 +4997,7 @@ int mainloop NOARGS char *temp = NULL; BOOLEAN ForcePush = FALSE; BOOLEAN override_LYresubmit_posts = FALSE; + BOOLEAN newdoc_link_is_absolute = FALSE; unsigned int len; int i; int follow_col = -1; @@ -5008,7 +5006,7 @@ int mainloop NOARGS * 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 +5029,7 @@ int mainloop NOARGS #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); @@ -5249,6 +5247,7 @@ try_again: 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,12 +5261,24 @@ try_again: * 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; #endif + FREE(LYRequestReferer); + /* + * Don't send Referer if we have to load a document again + * that we got from the history stack. We don't know + * any more how we originally got to that page. Using + * a Referer based on the current HTMainText could only + * be right by coincidence. - kw 1999-11-01 + */ + if (popped_doc) + LYNoRefererForThis = TRUE; + #ifndef DONT_TRACK_INTERNAL_LINKS if (try_internal) { if (newdoc.address && @@ -5559,7 +5570,6 @@ try_again: 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 +5729,7 @@ try_again: } #else Newline = newdoc.line; /* now here, no partial mode */ + /* *search_target = '\0'; */ /* Reset for this document. - FM */ #endif /* @@ -6033,7 +6044,7 @@ try_again: refresh_screen = FALSE; - HText_pageDisplay(Newline, prev_target); + HText_pageDisplay(Newline); #ifdef DIRED_SUPPORT if (lynx_edit_mode && nlinks > 0 && !HTList_isEmpty(tagged)) @@ -6058,6 +6069,17 @@ try_again: } } + /* + * If the request is to highlight a link which is counted + * from the start of document, correct the link number: + */ + if (newdoc_link_is_absolute) { + newdoc_link_is_absolute = FALSE; + if (curdoc.line > 1) + newdoc.link -= HText_LinksInLines(HTMainText, 1, + curdoc.line - 1); + } + if (arrowup) { /* * arrowup is set if we just came up from @@ -6101,7 +6123,7 @@ try_again: #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)) @@ -6213,7 +6235,13 @@ try_again: * to tell the user other misc info. */ if (!show_help) { - show_main_statusline(links[curdoc.link]); +#ifndef NO_NONSTICKY_INPUTS + show_main_statusline(links[curdoc.link], + (!sticky_inputs && !textinput_activated) ? + FOR_PANEL : FOR_INPUT); +#else + show_main_statusline(links[curdoc.link], FOR_INPUT); +#endif } else { show_help = FALSE; } @@ -6225,7 +6253,7 @@ try_again: /* * Highlight current link. */ - highlight(ON, curdoc.link, prev_target); + highlight(ON, curdoc.link); } if (traversal) { @@ -6318,7 +6346,7 @@ try_again: 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 || @@ -6331,7 +6359,7 @@ try_again: switch (c) { case '\n': case '\r': -#ifdef AUTOGROW +#ifdef TEXTAREA_AUTOGROW /* * If on the bottom line of a TEXTAREA, and the user hit * the ENTER key, we add a new line/anchor automatically, @@ -6390,7 +6418,7 @@ try_again: #endif } -#endif /* AUTOGROW */ +#endif /* TEXTAREA_AUTOGROW */ /* * Make return in input field (if it was returned @@ -6502,7 +6530,7 @@ new_cmd: /* links[curdoc.link].form->type == F_PASSWORD_TYPE || links[curdoc.link].form->type == F_TEXTAREA_TYPE)) - show_main_statusline(links[curdoc.link]); + show_main_statusline(links[curdoc.link], FOR_PANEL); else if (more) HTInfoMsg(MOREHELP); else @@ -6533,7 +6561,7 @@ new_cmd: /* 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 +6616,11 @@ new_cmd: /* 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,44 +6702,44 @@ new_cmd: /* 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 */ + case LYK_COOKIE_JAR: /* show the cookie jar */ if (handle_LYK_COOKIE_JAR(&cmd)) goto new_cmd; break; @@ -6721,7 +6749,7 @@ new_cmd: /* break; /* FALLTHRU */ - case LYK_PREV_DOC: /* back up a level */ + case LYK_PREV_DOC: /* back up a level */ switch (handle_PREV_DOC(&cmd, &old_c, real_c)) { case 1: return(0); @@ -6737,7 +6765,7 @@ new_cmd: /* /* 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: @@ -6755,7 +6783,7 @@ new_cmd: /* do_check_goto_URL(user_input_buffer, &temp, &force_load); break; - case LYK_GOTO: /* 'g' to goto a random URL */ + case LYK_GOTO: /* 'g' to goto a random URL */ if (handle_LYK_GOTO(&ch, user_input_buffer, &temp, &recall, &URLTotal, &URLNum, &FirstURLRecall, &old_c, real_c)) { @@ -6778,7 +6806,7 @@ new_cmd: /* 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 */ @@ -6790,18 +6818,18 @@ new_cmd: /* handle_LYK_INDEX_SEARCH(&force_load, ForcePush, &old_c, real_c); break; - 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); + case LYK_WHEREIS: /* search within the document */ + case LYK_NEXT: /* find the next occurrence in the document */ + handle_LYK_WHEREIS(cmd, &refresh_screen); break; - case LYK_COMMENT: /* reply by mail */ + case LYK_COMMENT: /* reply by mail */ handle_LYK_COMMENT(&refresh_screen, &owner_address, &old_c, real_c); break; #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 */ @@ -6822,7 +6850,7 @@ new_cmd: /* } /* FALLTHRU */ - case LYK_EDIT: /* edit */ + case LYK_EDIT: /* edit */ handle_LYK_EDIT(&old_c, real_c); break; @@ -6843,7 +6871,7 @@ new_cmd: /* #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; @@ -6851,32 +6879,32 @@ new_cmd: /* handle_LYK_EDIT_TEXTAREA(&refresh_screen, &old_c, real_c); break; - case LYK_GROW_TEXTAREA: /* add new lines to bottom of TEXTAREA - KED */ + case LYK_GROW_TEXTAREA: /* add new lines to bottom of TEXTAREA - KED */ handle_LYK_GROW_TEXTAREA(&refresh_screen); break; - case LYK_INSERT_FILE: /* insert file in TEXTAREA, above cursor - KED */ + case LYK_INSERT_FILE: /* insert file in TEXTAREA, above cursor - KED */ handle_LYK_INSERT_FILE(&refresh_screen, &old_c, real_c); break; - case LYK_PRINT: /* print the file */ + case LYK_PRINT: /* print the file */ handle_LYK_PRINT(&ForcePush, &old_c, real_c); break; - case LYK_LIST: /* list links in the current document */ + case LYK_LIST: /* list links in the current document */ if (handle_LYK_LIST(&cmd)) goto new_cmd; break; #ifdef EXP_ADDRLIST_PAGE - case LYK_ADDRLIST: /* always list URL's (only) */ + case LYK_ADDRLIST: /* always list URL's (only) */ if (handle_LYK_ADDRLIST(&cmd)) goto new_cmd; break; #endif /* EXP_ADDRLIST_PAGE */ case LYK_VLINKS: /* list links visited during the current session */ - if (handle_LYK_VLINKS(&cmd)) + if (handle_LYK_VLINKS(&cmd, &newdoc_link_is_absolute)) goto new_cmd; break; @@ -6891,7 +6919,7 @@ new_cmd: /* #endif /* DIRED_SUPPORT || VMS*/ #ifdef USE_EXTERNALS - case LYK_EXTERN: /* use external program on url */ + case LYK_EXTERN: /* use external program on url */ handle_LYK_EXTERN(&refresh_screen); break; #endif /* USE_EXTERNALS */ @@ -6900,16 +6928,16 @@ new_cmd: /* handle_LYK_ADD_BOOKMARK(&refresh_screen, &old_c, real_c); break; - case LYK_VIEW_BOOKMARK: /* v to view home page */ + case LYK_VIEW_BOOKMARK: /* v to view home page */ handle_LYK_VIEW_BOOKMARK(&refresh_screen, &old_c, real_c); break; - case LYK_SHELL: /* (!) shell escape */ + case LYK_SHELL: /* (!) shell escape */ handle_LYK_SHELL(&refresh_screen, &old_c, real_c); 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: @@ -7266,8 +7294,9 @@ PUBLIC void HTAddGotoURL ARGS1( * put a message on the screen * to tell the user other misc info. */ -PRIVATE void show_main_statusline ARGS1( - CONST linkstruct, curlink) +PRIVATE void show_main_statusline ARGS2( + CONST linkstruct, curlink, + int, for_what) { /* * Make sure form novice lines are replaced. @@ -7299,7 +7328,7 @@ PRIVATE void show_main_statusline ARGS1( #endif /* NORMAL_NON_FORM_LINK_STATUSLINES_FOR_ALL_USER_MODES */ #endif /* INDICATE_FORMS_MODE_FOR_ALL_LINKS_ON_PAGE */ if (curlink.type == WWW_FORM_LINK_TYPE) { - show_formlink_statusline(curlink.form); + show_formlink_statusline(curlink.form, for_what); } else { statusline(NORMAL_LINK_MESSAGE); } @@ -7361,10 +7390,11 @@ PRIVATE void show_main_statusline ARGS1( * selected link. It should only be called at times when curdoc.link, * nlinks, and the links[] array are valid. - kw */ -PUBLIC void repaint_main_statusline NOARGS +PUBLIC void repaint_main_statusline ARGS1( + int, for_what) { if (curdoc.link >= 0 && curdoc.link < nlinks) - show_main_statusline(links[curdoc.link]); + show_main_statusline(links[curdoc.link], for_what); } diff --git a/src/LYMainLoop.h b/src/LYMainLoop.h index 44923639..0bc7d1e0 100644 --- a/src/LYMainLoop.h +++ b/src/LYMainLoop.h @@ -5,14 +5,15 @@ #include <HTUtils.h> #endif -#define TEXTAREA_EXPAND_SIZE 5 -#define AUTOGROW -#define AUTOEXTEDIT - extern BOOLEAN LYOpenTraceLog NOPARAMS; extern int mainloop NOPARAMS; extern void HTAddGotoURL PARAMS((char *url)); extern void LYCloseTracelog NOPARAMS; -extern void repaint_main_statusline NOPARAMS; +extern void repaint_main_statusline PARAMS((int for_what)); + +/* 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 --git a/src/LYOptions.c b/src/LYOptions.c index ab88556a..1b61f780 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -3336,8 +3336,20 @@ static OptValues user_mode_values[] = { { INTERMEDIATE_MODE, "Intermediate", "Intermediate" }, { ADVANCED_MODE, "Advanced", "Advanced" }, { 0, 0, 0 }}; + static char * vi_keys_string = "vi_keys"; +static char * visited_pages_type_string = "visited_pages_type"; +static OptValues visited_pages_type_values[] = { + { VISITED_LINKS_AS_FIRST_V, "By First Visit", "first_visited" }, + { VISITED_LINKS_AS_FIRST_V | VISITED_LINKS_REVERSE, + "By First Visit Reversed", "first_visited_reversed" }, + { VISITED_LINKS_AS_TREE, "As Visit Tree", "visit_tree" }, + { VISITED_LINKS_AS_LATEST, "By Last Visit", "last_visited" }, + { VISITED_LINKS_AS_LATEST | VISITED_LINKS_REVERSE, + "By Last Visit Reversed", "last_visited_reversed" }, + { 0, 0, 0 }}; + /* * Document Layout */ @@ -3795,6 +3807,10 @@ PUBLIC int postoptions ARGS1( } } + /* Type of visited pages page: SELECT */ + if (!strcmp(data[i].tag, visited_pages_type_string)) + GetOptValues(visited_pages_type_values, data[i].value, &Visited_Links_As); + /* Show Images: SELECT */ if (!strcmp(data[i].tag, images_string)) { if (!strcmp(data[i].value, images_ignore_all_string) @@ -4357,6 +4373,12 @@ PRIVATE int gen_options ARGS1( PutOptValues(fp0, vi_keys, bool_values); EndSelect(fp0); + /* Visited Pages: SELECT */ + PutLabel(fp0, gettext("Visited Pages")); + BeginSelect(fp0, visited_pages_type_string); + PutOptValues(fp0, Visited_Links_As, visited_pages_type_values); + EndSelect(fp0); + /* Display Character Set: SELECT */ PutLabel(fp0, gettext("Display character set")); BeginSelect(fp0, display_char_set_string); diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index e3adb938..c31f702c 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -819,6 +819,18 @@ static int printer_fun ARGS1( return 0; } +static int referer_with_query_fun ARGS1( + char *, value) +{ + if (!strncasecomp(value, "SEND", 4)) + LYRefererWithQuery = 'S'; + else if (!strncasecomp(value, "PARTIAL", 7)) + LYRefererWithQuery = 'P'; + else + LYRefererWithQuery = 'D'; + return 0; +} + #ifdef SOURCE_CACHE static int source_cache_fun ARGS1( char *, value) @@ -1392,6 +1404,7 @@ static Config_Type Config_Table [] = PARSE_SET("psrcview_no_anchor_numbering", CONF_BOOL, &psrcview_no_anchor_numbering), #endif PARSE_SET("quit_default_yes", CONF_BOOL, &LYQuitDefaultYes), + PARSE_SET("referer_with_query", CONF_FUN, referer_with_query_fun), PARSE_SET("reuse_tempfiles", CONF_BOOL, &LYReuseTempfiles), #ifndef NO_RULES PARSE_FUN("rule", CONF_FUN, HTSetConfiguration), diff --git a/src/LYSearch.c b/src/LYSearch.c index 995d8135..e6960489 100644 --- a/src/LYSearch.c +++ b/src/LYSearch.c @@ -28,7 +28,7 @@ PRIVATE int check_for_target_in_links ARGS2( return(FALSE); for (; i < nlinks; i++) { - /* + /* * Search the hightext string, and hightext2 if present, * taking the case_sensitive setting into account. - FM */ @@ -52,7 +52,7 @@ PRIVATE int check_for_target_in_links ARGS2( if ((links[i].form != NULL && links[i].form->value != NULL) && links[i].form->type != F_HIDDEN_TYPE) { if (links[i].form->type == F_PASSWORD_TYPE) { - /* + /* * Check the actual, hidden password, and then * the displayed string. - FM */ @@ -100,7 +100,7 @@ PRIVATE int check_for_target_in_links ARGS2( /* * Search for checked or unchecked parens. - FM */ - if (links[i].form->num_value) { + if (links[i].form->num_value) { cp = checked_radio; } else { cp = unchecked_radio; @@ -115,7 +115,7 @@ PRIVATE int check_for_target_in_links ARGS2( /* * Search for checked or unchecked square brackets. - FM */ - if (links[i].form->num_value) { + if (links[i].form->num_value) { cp = checked_box; } else { cp = unchecked_box; @@ -127,7 +127,7 @@ PRIVATE int check_for_target_in_links ARGS2( break; } } else { - /* + /* * Check the values intended for display. * May have been found already via the * hightext search, but make sure here @@ -192,14 +192,14 @@ PUBLIC BOOL textsearch ARGS3( QueryNum = QueryTotal; if (next) - /* + /* * LYK_NEXT was pressed, so copy the * buffer into prev_target. - FM */ strcpy(prev_target, prev_target_buffer); if (strlen(prev_target) == 0 ) { - /* + /* * This is a new WHEREIS search ('/'), or * LYK_NEXT was pressed but there was no * previous search, so we need to get a @@ -208,7 +208,7 @@ PUBLIC BOOL textsearch ARGS3( _statusline(ENTER_WHEREIS_QUERY); if ((ch = LYgetstr(prev_target, VISIBLE, - sizeof(prev_target_buffer), recall)) < 0) { + sizeof(prev_target_buffer), recall)) < 0) { /* * User cancelled the search via ^G. * Restore prev_target and return. - FM @@ -221,14 +221,14 @@ PUBLIC BOOL textsearch ARGS3( check_recall: if (strlen(prev_target) == 0 && - !(recall && (ch == UPARROW || ch == DNARROW))) { - /* + !(recall && (ch == UPARROW || ch == DNARROW))) { + /* * No entry. Simply return, retaining the current buffer. * Because prev_target is now reset, highlighting of the * previous search string will no longer occur, but it can * be used again via LYK_NEXT. - FM */ - HTInfoMsg(CANCELLED); + HTInfoMsg(CANCELLED); return(FALSE); } @@ -239,11 +239,11 @@ check_recall: */ FirstRecall = FALSE; if (*prev_target_buffer) { - for (QueryNum = (QueryTotal - 1); QueryNum > 0; QueryNum--) { + for (QueryNum = (QueryTotal - 1); QueryNum > 0; QueryNum--) { if ((cp = (char *)HTList_objectAt(search_queries, - QueryNum)) != NULL && - !strcmp(prev_target_buffer, cp)) { - break; + QueryNum)) != NULL && + !strcmp(prev_target_buffer, cp)) { + break; } } } else { @@ -261,10 +261,10 @@ check_recall: */ QueryNum = 0; if ((cp = (char *)HTList_objectAt(search_queries, - QueryNum)) != NULL) { + QueryNum)) != NULL) { strcpy(prev_target, cp); if (*prev_target_buffer && - !strcmp(prev_target_buffer, prev_target)) { + !strcmp(prev_target_buffer, prev_target)) { _statusline(EDIT_CURRENT_QUERY); } else if ((*prev_target_buffer && QueryTotal == 2) || (!(*prev_target_buffer) && QueryTotal == 1)) { @@ -273,9 +273,9 @@ check_recall: _statusline(EDIT_A_PREV_QUERY); } if ((ch = LYgetstr(prev_target, VISIBLE, - sizeof(prev_target_buffer), recall)) < 0) { - /* - * User cancelled the search via ^G. + sizeof(prev_target_buffer), recall)) < 0) { + /* + * User canceled the search via ^G. * Restore prev_target and return. - FM */ strcpy(prev_target, prev_target_buffer); @@ -291,11 +291,11 @@ check_recall: */ FirstRecall = FALSE; if (*prev_target_buffer) { - for (QueryNum = 0; QueryNum < (QueryTotal - 1); QueryNum++) { + for (QueryNum = 0; QueryNum < (QueryTotal - 1); QueryNum++) { if ((cp = (char *)HTList_objectAt(search_queries, - QueryNum)) != NULL && - !strcmp(prev_target_buffer, cp)) { - break; + QueryNum)) != NULL && + !strcmp(prev_target_buffer, cp)) { + break; } } } else { @@ -313,10 +313,10 @@ check_recall: */ QueryNum = QueryTotal - 1; if ((cp = (char *)HTList_objectAt(search_queries, - QueryNum)) != NULL) { + QueryNum)) != NULL) { strcpy(prev_target, cp); if (*prev_target_buffer && - !strcmp(prev_target_buffer, prev_target)) { + !strcmp(prev_target_buffer, prev_target)) { _statusline(EDIT_CURRENT_QUERY); } else if ((*prev_target_buffer && QueryTotal == 2) || (!(*prev_target_buffer) && QueryTotal == 1)) { @@ -326,7 +326,7 @@ check_recall: } if ((ch = LYgetstr(prev_target, VISIBLE, sizeof(prev_target_buffer), recall)) < 0) { - /* + /* * User cancelled the search via ^G. * Restore prev_target and return. - FM */ @@ -351,7 +351,7 @@ check_recall: /* * Found in link, changed cur, we're done. */ - highlight(OFF, oldcur, prev_target); + highlight(OFF, oldcur); return(TRUE); } @@ -371,7 +371,7 @@ check_recall: */ 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 --git a/src/LYStrings.c b/src/LYStrings.c index dd55c262..531ce5ec 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -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> @@ -1364,11 +1366,11 @@ PRIVATE int LYmouse_menu ARGS4(int, x, int, y, int, atlink, int, code) mouse_link = -1; /* mainloop should not change cur link - kw */ } if (code == FOR_INPUT && retlac == LYK_DO_NOTHING) { - repaint_main_statusline(); + repaint_main_statusline(FOR_INPUT); } return retlac; } -#endif +#endif /* NCURSES_MOUSE_VERSION */ #if defined(USE_KEYMAPS) && defined(USE_SLANG) diff --git a/src/LYStrings.h b/src/LYStrings.h index ac85f315..31f7fed0 100644 --- a/src/LYStrings.h +++ b/src/LYStrings.h @@ -278,6 +278,8 @@ extern void LYRefreshEdit PARAMS(( EditFieldData * edit)); extern int EditBinding PARAMS((int ch)); /* in LYEditmap.c */ extern int LYRemapEditBinding PARAMS((int xlkc, int lec)); /* in LYEditmap.c */ +extern int LYKeyForEditAction PARAMS((int lec)); /* in LYEditmap.c */ +extern int LYEditKeyForAction PARAMS((int lac, int *pmodkey));/* LYEditmap.c */ extern int LYEdit1 PARAMS(( EditFieldData * edit, int ch, diff --git a/src/LYStructs.h b/src/LYStructs.h index 78075f48..f8f276c8 100644 --- a/src/LYStructs.h +++ b/src/LYStructs.h @@ -60,9 +60,22 @@ typedef struct _histstruct { "internal links", otherwise -1 */ } histstruct; +extern int Visited_Links_As; + +#define VISITED_LINKS_AS_FIRST_V 0 +#define VISITED_LINKS_AS_TREE 1 +#define VISITED_LINKS_AS_LATEST 2 +#define VISITED_LINKS_REVERSE 4 + typedef struct _VisitedLink { char * title; char * address; + int level; + struct _VisitedLink *next_tree; + struct _VisitedLink *prev_tree; + struct _VisitedLink *prev_latest; + struct _VisitedLink *next_latest; + struct _VisitedLink *prev_first; } VisitedLink; extern histstruct history[MAXHIST]; diff --git a/src/LYUtils.c b/src/LYUtils.c index de1c7112..0809b89e 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -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 @@ PUBLIC HTList * sug_filenames = NULL; /* Suggested filenames */ /* * 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 @@ PUBLIC void highlight ARGS3( 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'; /* @@ -1910,12 +1912,13 @@ PUBLIC void statusline ARGS1( } #if 0 /* This is broken. It shows a truncated name if the complete URL is - so long that it has already been shortened by the caller to fit. - Moreover it doesn't belong here. This function should just display - what it's asked to and not second-guess its caller. If you want - a different message displayed, pass it a different message. - Finally, I dislike the intended change anyway. It shows less - information, it is a dumbed down interface. - kw */ + * so long that it has already been shortened by the caller to fit. + * Moreover it doesn't belong here. This function should just display + * what it's asked to and not second-guess its caller. If you want + * a different message displayed, pass it a different message. + * Finally, I dislike the intended change anyway. It shows less + * information, it is a dumbed down interface. - kw + */ if (strncmp(text, "LYNXDOWNLOAD:", 13) == 0) { p = strstr(text + 13, "SugFile="); if (p != NULL) { @@ -2098,7 +2101,7 @@ PUBLIC void noviceline ARGS1( clrtoeol(); #if defined(DIRED_SUPPORT ) && defined(OK_OVERRIDE) if (lynx_edit_mode && !no_dired_support) - addstr(DIRED_NOVICELINE); + addstr(DIRED_NOVICELINE); else #endif /* DIRED_SUPPORT && OK_OVERRIDE */ @@ -2200,6 +2203,7 @@ PRIVATE int DontCheck NOARGS PUBLIC int HTCheckForInterrupt NOARGS { int c; + int cmd; #ifndef VMS /* UNIX stuff: */ #ifndef USE_SLANG struct timeval socket_timeout; @@ -2307,24 +2311,33 @@ PUBLIC int HTCheckForInterrupt NOARGS /* 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... */ { - int res; - switch (LKC_TO_LAC(keymap,c)) + BOOLEAN do_refresh; + int res; + switch (cmd) { + case LYK_WHEREIS: /* search within the document */ + case LYK_NEXT: /* search for the next occurrence in the document */ + handle_LYK_WHEREIS(cmd, &do_refresh); + if (do_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 +2406,7 @@ PUBLIC int HTCheckForInterrupt NOARGS if (Newline_partial < 1) Newline_partial = 1; NumOfLines_partial = HText_getNumOfLines(); - HText_pageDisplay(Newline_partial, ""); + HText_pageDisplay(Newline_partial); } #endif /* DISP_PARTIAL */ break; @@ -4303,7 +4316,7 @@ PUBLIC void LYConvertToURL ARGS2( * Home_Dir(), and assume the rest of the path, if * any, has SHELL syntax. */ - StrAllocCat(*AllocatedString, HTVMS_wwwName((char *)Home_Dir())); + StrAllocCat(*AllocatedString, HTVMS_wwwName(Home_Dir())); if ((cp = strchr(old_string, '/')) != NULL) { /* * Append rest of path, if present, skipping "user" if @@ -4693,7 +4706,7 @@ have_VMS_URL: * login directory. - FM */ #ifdef VMS - StrAllocCat(*AllocatedString, HTVMS_wwwName((char *)Home_Dir())); + StrAllocCat(*AllocatedString, HTVMS_wwwName(Home_Dir())); #else StrAllocCat(*AllocatedString, "/"); } else if ((stat(old_string, &st) > -1) || @@ -5809,7 +5822,7 @@ PUBLIC time_t LYmktime ARGS2( */ start = s; while (*s != '\0' && isdigit((unsigned char)*s)) - s++; + s++; if (*s == '\0' || (s - start) > 2) return(0); LYstrncpy(temp, start, (int)(s - start)); @@ -6740,10 +6753,10 @@ PUBLIC char * wwwName ARGS1( char *cp = NULL; #ifdef DOSPATH - cp = HTDOS_wwwName((char *)pathname); + cp = HTDOS_wwwName(pathname); #else #ifdef VMS - cp = HTVMS_wwwName((char *)pathname); + cp = HTVMS_wwwName(pathname); #else cp = (char *)pathname; #endif /* VMS */ @@ -7601,7 +7614,7 @@ PUBLIC char * w32_strerror(DWORD ercode) * syslog() interface */ PUBLIC void LYOpenlog ARGS1( - CONST char *, banner) + CONST char *, banner) { #if defined(WATT32) openlog("lynx", LOG_PID|LOG_NDELAY, LOG_LOCAL5); @@ -7635,7 +7648,7 @@ PRIVATE BOOLEAN looks_like_password ARGS2( } PUBLIC void LYSyslog ARGS1( - char *, arg) + char *, arg) { char *colon1; char *colon2; diff --git a/src/LYUtils.h b/src/LYUtils.h index a7072fcd..4f935233 100644 --- a/src/LYUtils.h +++ b/src/LYUtils.h @@ -118,7 +118,7 @@ extern void LYsetXDisplay PARAMS((char *new_display)); 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)); diff --git a/src/TRSTable.c b/src/TRSTable.c index 7e65fc2f..68b3fa31 100644 --- a/src/TRSTable.c +++ b/src/TRSTable.c @@ -109,8 +109,7 @@ struct _STable_info { ** Implemented: ** - ALIGN={left,right,center,justify} applied to individual table cells ** ("justify" is treated as "left") -** - Inheritance of horizontal alignment according to HTML 4.0 (with the -** exception of COLGROUP/COL) +** - Inheritance of horizontal alignment according to HTML 4.0 ** - COLSPAN >1 (may work incorrectly for some tables?) ** - ROWSPAN >1 (reserving cells in following rows) ** - Line breaks at start of first cell or at end of last cell are treated diff --git a/src/makefile.dos b/src/makefile.dos index 6c715a54..24c52d2f 100644 --- a/src/makefile.dos +++ b/src/makefile.dos @@ -9,23 +9,52 @@ LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o \ LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o LYExtern.o \ LYStyle.o LYHash.o LYPrettySrc.o TRSTable.o -CFLAGS= $(MCFLAGS) -I. -I.. $(SLANGINC) +CFLAGS= $(MCFLAGS) $(INTLFLAGS) -I. -I.. $(SLANGINC) # comment this line to suppress DIRED support -DIRED_DEFS = -DDIRED_SUPPORT -DOK_UUDECODE -DOK_TAR -DOK_GZIP -DOK_ZIP +DIRED_DEFS = \ + -DDIRED_SUPPORT \ + -DOK_UUDECODE \ + -DOK_TAR \ + -DOK_GZIP \ + -DOK_ZIP \ + -DOK_OVERRIDE CC = gcc -MCFLAGS = -O2 -DHAVE_GETBKGD -DDISP_PARTIAL -DUSE_ZLIB \ - -DSOURCE_CACHE -DUSE_PSRC \ - -DUSE_EXTERNALS -DCOLOR_CURSES -DNCURSES -DFANCY_CURSES \ - -DACCESS_AUTH -DNO_CUSERID -DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP \ - -DEXP_PERSISTENT_COOKIES -DEXP_ADDRLIST_PAGE -DEXP_ALT_BINDINGS \ + +MCFLAGS = -O2 \ + $(DIRED_DEFS) \ + -DACCESS_AUTH \ + -DCOLOR_CURSES \ + -DDISP_PARTIAL \ + -DDOSPATH \ + -DEXP_ADDRLIST_PAGE \ + -DEXP_ALT_BINDINGS \ -DEXP_FILE_UPLOAD \ + -DEXP_PERSISTENT_COOKIES \ + -DFANCY_CURSES \ + -DHAVE_GETBKGD \ + -DNCURSES \ + -DNOUSERS \ + -DNO_CUSERID \ + -DNO_TTYTYPE \ + -DNO_UTMP \ + -DSOURCE_CACHE \ + -DUSE_EXTERNALS \ + -DUSE_PSRC \ + -DUSE_ZLIB \ -DWATT32 \ - $(DIRED_DEFS) \ - -I./chrtrans -I../WWW/Library/Implementation \ - -I../curses -I../djgpp/watt32/inc -I../djgpp/watt32/inc/sys -WWWLIB = ../WWW/Library/djgpp/libwww.a ../curses/pdcurses.a ../djgpp/watt32/lib/libwatt.a + -I./chrtrans \ + -I../WWW/Library/Implementation \ + -I../curses \ + -I../djgpp/watt32/inc \ + -I../djgpp/watt32/inc/sys + +WWWLIB = \ + ../WWW/Library/djgpp/libwww.a \ + ../curses/pdcurses.a \ + ../djgpp/watt32/lib/libwatt.a + LIBS= -lz # -lintl #INTLFLAGS = -DHAVE_GETTEXT -DHAVE_LIBINTL_H @@ -33,7 +62,7 @@ all: lynx lynx: message $(OBJS) $(WWWLIB) @echo "Linking and creating Lynx executable" - $(CC) $(CFLAGS) -o lynx.exe $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS) + $(CC) $(CFLAGS) -o lynx.exe $(OBJS) $(WWWLIB) $(LIBS) @echo "Welcome to Lynx!" message: @@ -41,7 +70,7 @@ message: dbg: $(OBJS) $(WWWLIB) @echo "Making Lynx code" - $(CC) -g $(OBJS) $(CFLAGS) $(WWWLIB) $(SLANGLIB) $(LIBS) + $(CC) -g $(OBJS) $(CFLAGS) $(WWWLIB) $(LIBS) lint: lint *.c > ../lint.out @@ -68,3 +97,4 @@ LYReadCFG.o: ../userdefs.h LYShowInfo.o: ../userdefs.h LYStrings.o: ../userdefs.h LYTraversal.o: ../userdefs.h +LYUtils.o: ../userdefs.h diff --git a/src/makefile.dsl b/src/makefile.dsl index 093bcb0c..abb1815d 100644 --- a/src/makefile.dsl +++ b/src/makefile.dsl @@ -12,34 +12,57 @@ LYStyle.o LYHash.o LYPrettySrc.o TRSTable.o CFLAGS= $(MCFLAGS) $(INTLFLAGS) -I. -I.. $(SLANGINC) # comment this line to suppress DIRED support -DIRED_DEFS = -DDIRED_SUPPORT -DOK_UUDECODE -DOK_TAR -DOK_GZIP -DOK_ZIP +DIRED_DEFS = \ + -DDIRED_SUPPORT \ + -DOK_UUDECODE \ + -DOK_TAR \ + -DOK_GZIP \ + -DOK_ZIP \ + -DOK_OVERRIDE CC = gcc -MCFLAGS = -O2 -DDISP_PARTIAL -DUSE_ZLIB -DUSE_EXTERNALS \ --DWATT32 \ -$(DIRED_DEFS) \ --DSOURCE_CACHE -DUSE_PSRC \ --DUSE_SLANG -DDJGPP_KEYHANDLER -DACCESS_AUTH -DNO_CUSERID \ --DNOUSERS -DDOSPATH -DNO_TTYTYPE -DNO_UTMP -I../WWW/Library/Implementation \ --I../djgpp/watt32/inc -I./chrtrans -I../djgpp/watt32/inc/sys -WWWLIB = ../WWW/Library/djgpp/libwww.a ../djgpp/watt32/lib/libwatt.a -LIBS= -lslang -lz # -lintl -CHRTR= ./chrtrans/ + +MCFLAGS = -O2 \ + $(DIRED_DEFS) \ + -DACCESS_AUTH \ + -DDISP_PARTIAL \ + -DDJGPP_KEYHANDLER \ + -DDOSPATH \ + -DNOUSERS \ + -DNO_CUSERID \ + -DNO_TTYTYPE \ + -DNO_UTMP \ + -DSOURCE_CACHE \ + -DUSE_EXTERNALS \ + -DUSE_PSRC \ + -DUSE_SLANG \ + -DUSE_ZLIB \ + -DWATT32 \ + -I./chrtrans \ + -I../WWW/Library/Implementation \ + -I../djgpp/watt32/inc \ + -I../djgpp/watt32/inc/sys + +WWWLIB = \ + ../WWW/Library/djgpp/libwww.a \ + ../djgpp/watt32/lib/libwatt.a + +LIBS= $(SLANGLIB) -lslang -lz # -lintl #INTLFLAGS = -DHAVE_GETTEXT -DHAVE_LIBINTL_H all: lynx.exe lynx.exe: message $(OBJS) $(WWWLIB) @echo "Linking and creating Lynx executable" - $(CC) $(CFLAGS) -o lynx.exe $(OBJS) $(WWWLIB) $(SLANGLIB) $(LIBS) + $(CC) $(CFLAGS) -o lynx.exe $(OBJS) $(WWWLIB) $(LIBS) @echo "Welcome to Lynx!" message: @echo "Compiling Lynx sources" -dbg: $(OBJS) $(WWWLIB) +dbg: $(OBJS) $(WWWLIB) @echo "Making Lynx code" - $(CC) $(OBJS) $(CFLAGS) $(WWWLIB) $(SLANGLIB) $(LIBS) + $(CC) -g $(OBJS) $(CFLAGS) $(WWWLIB) $(LIBS) lint: lint *.c > ../lint.out @@ -63,7 +86,6 @@ LYMain.o: ../userdefs.h LYMainLoop.o: ../userdefs.h LYOptions.o: ../userdefs.h LYReadCFG.o: ../userdefs.h -LYReadCFG.o: ../userdefs.h LYShowInfo.o: ../userdefs.h LYStrings.o: ../userdefs.h LYTraversal.o: ../userdefs.h |