diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1999-07-30 16:06:54 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1999-07-30 16:06:54 -0400 |
commit | 9c512bbadc47a7de000f53f11a7620d83ca0ddba (patch) | |
tree | 8580cd97bbe59c18fa8d8ee0dbf8e67e1ad413db /src | |
parent | a2a1ab1ed484fec332c6dcccb8d033f1c33bb0b5 (diff) | |
download | lynx-snapshots-9c512bbadc47a7de000f53f11a7620d83ca0ddba.tar.gz |
snapshot of project "lynx", label v2-8-3dev_5
Diffstat (limited to 'src')
-rw-r--r-- | src/GridText.c | 73 | ||||
-rw-r--r-- | src/GridText.h | 7 | ||||
-rw-r--r-- | src/HTAlert.c | 118 | ||||
-rw-r--r-- | src/HTFWriter.c | 4 | ||||
-rw-r--r-- | src/HTForms.h | 46 | ||||
-rw-r--r-- | src/HTML.c | 49 | ||||
-rw-r--r-- | src/LYBookmark.c | 10 | ||||
-rw-r--r-- | src/LYCookie.c | 4 | ||||
-rw-r--r-- | src/LYCurses.c | 10 | ||||
-rw-r--r-- | src/LYCurses.h | 16 | ||||
-rw-r--r-- | src/LYForms.c | 73 | ||||
-rw-r--r-- | src/LYGlobalDefs.h | 109 | ||||
-rw-r--r-- | src/LYJustify.h | 4 | ||||
-rw-r--r-- | src/LYLocal.c | 4 | ||||
-rw-r--r-- | src/LYMain.c | 35 | ||||
-rw-r--r-- | src/LYMainLoop.c | 251 | ||||
-rw-r--r-- | src/LYNews.c | 7 | ||||
-rw-r--r-- | src/LYOptions.c | 5 | ||||
-rw-r--r-- | src/LYPrint.c | 28 | ||||
-rw-r--r-- | src/LYReadCFG.c | 5 | ||||
-rw-r--r-- | src/LYStrings.c | 63 | ||||
-rw-r--r-- | src/LYStrings.h | 4 | ||||
-rw-r--r-- | src/LYStyle.c | 65 | ||||
-rw-r--r-- | src/LYUtils.c | 78 | ||||
-rw-r--r-- | src/LYUtils.h | 2 | ||||
-rw-r--r-- | src/Xsystem.c | 9 | ||||
-rw-r--r-- | src/chrtrans/makefile.bcb | 114 | ||||
-rw-r--r-- | src/chrtrans/makefile.w32 | 129 | ||||
-rw-r--r-- | src/chrtrans/makew32.bat | 8 |
29 files changed, 926 insertions, 404 deletions
diff --git a/src/GridText.c b/src/GridText.c index f50cac68..54631f8a 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -103,7 +103,6 @@ extern HTCJKlang HTCJK; #ifdef CJK_EX PUBLIC HTkcode last_kcode = NOKANJI; /* 1997/11/14 (Fri) 09:09:26 */ -extern char *str_kcode(HTkcode code); #define CHAR_WIDTH 6 #else #define CHAR_WIDTH 1 @@ -210,6 +209,7 @@ struct _HText { BOOLEAN minimal_comments; BOOLEAN soft_dquotes; BOOLEAN old_dtd; + int keypad_mode; int lines; /* Screen size */ int cols; #endif @@ -276,6 +276,7 @@ PUBLIC int wait_for_this_stacked_elt;/* -1 if can justify contents of the ok_justify ==FALSE or in psrcview. */ PUBLIC BOOL form_in_htext;/*to indicate that we are in form (since HTML_FORM is not stacked in the HTML.c */ +PUBLIC BOOL in_DT = FALSE; #ifdef DEBUG_JUSTIFY PUBLIC BOOL can_justify_stack_depth;/* can be 0 or 1 if all code is correct*/ #endif @@ -300,8 +301,18 @@ static int justified_text_map[MAX_LINE]; /* this is a map - for each index i PUBLIC void ht_justify_cleanup NOARGS { + wait_for_this_stacked_elt = !ok_justify +# ifdef USE_PSRC + || psrc_view +# endif + ? 30000/*MAX_NESTING*/+2 /*some unreachable value*/ : -1; + can_justify_here = TRUE; + can_justify_this_line = TRUE; + form_in_htext = FALSE; + last_anchor_of_previous_line = NULL; this_line_was_splitted = FALSE; + in_DT = FALSE; } PUBLIC void mark_justify_start_position ARGS1(void*,text) @@ -314,7 +325,7 @@ PUBLIC void mark_justify_start_position ARGS1(void*,text) #define REALLY_CAN_JUSTIFY(text) ( (wait_for_this_stacked_elt<0) && \ ( text->style->alignment == HT_LEFT || \ text->style->alignment == HT_JUSTIFY) && \ - HTCJK == NOCJK && \ + HTCJK == NOCJK && !in_DT && \ can_justify_here && can_justify_this_line && !form_in_htext ) #endif /* EXP_JUSTIFY_ELTS */ @@ -523,6 +534,8 @@ PUBLIC HText * HText_new ARGS1( if (!self) return self; + CTRACE(tfp, "GridText: start HText_new\n"); + #if defined(VMS) && defined (VAXC) && !defined(__DECC) status = lib$stat_vm(&VMType, &VMTotal); CTRACE(tfp, "GridText: VMTotal = %d\n", VMTotal); @@ -595,6 +608,7 @@ PUBLIC HText * HText_new ARGS1( self->minimal_comments = minimal_comments; self->soft_dquotes = soft_dquotes; self->old_dtd = Old_DTD; + self->keypad_mode = keypad_mode; self->lines = LYlines; self->cols = LYcols; #endif @@ -691,8 +705,9 @@ PUBLIC HText * HText_new ARGS1( self->last_lineno_last_disp_partial = -1; #endif - CTRACE(tfp, "GridText: start HText_new\n"); - +#ifdef EXP_JUSTIFY_ELTS + ht_justify_cleanup(); +#endif return self; } @@ -1193,8 +1208,20 @@ PRIVATE void display_title ARGS1( * account the possibility that multibyte * characters might be present. - FM */ +#ifdef SH_EX /* 1999/06/15 (Tue) 10:17:28 */ + int last; + last = (int)strlen(percent) + CHAR_WIDTH; + if (LYcols - 3 >= last) { + title[(LYcols - 3) - last] = '.'; + title[(LYcols - 2) - last] = '.'; + title[(LYcols - 1) - last] = '\0'; + } else { + title[(LYcols - 1) - last] = '\0'; + } +#else if ((i = ((LYcols - 2) - strlen(percent)) - CHAR_WIDTH) >= 0) title[i] = '\0'; +#endif move(0, CHAR_WIDTH); } addstr(title); @@ -2579,8 +2606,7 @@ PRIVATE void split_line ARGS2( for (i=0; i<j; ++i) *jdata++ = ' '; } - *m++ = justify_start_position + total_cell_len + - spare + ht_num_runs - 1; /*map the end*/ + *m++ = previous->size + spare; /*map the end */ text->chars += spare; @@ -2600,10 +2626,16 @@ PRIVATE void split_line ARGS2( /* now copy and fix colorstyles */ for(i = 0; i < jline->numstyles; ++i) { + int hpos = previous->styles[i].horizpos; + jline->styles[i].style = previous->styles[i].style; jline->styles[i].direction = previous->styles[i].direction; jline->styles[i].previous = previous->styles[i].previous; - jline->styles[i].horizpos = justified_text_map[previous->styles[i].horizpos]; + + /*there are stylechanges with hpos > line length */ + jline->styles[i].horizpos = (hpos > previous->size) + ? previous->size + spare + : justified_text_map[hpos]; } #endif /* we have to fix anchors*/ @@ -2652,7 +2684,7 @@ PRIVATE void split_line ARGS2( } else { /* This is the anchor that was started on previous - * line. Its .line_pos and .start were updated. + * line. Its .line_pos and .start were updated. * So we have to update only extent. If anchor * text is longer than two lines, we don't bother * setting it to correct value. @@ -6782,6 +6814,14 @@ PUBLIC BOOLEAN HTreparse_document NOARGS HTMainAnchor->source_cache_file); /* + * This magic FREE(anchor->UCStages) call + * stolen from HTuncache_current_document() above. + */ + if (!(HTOutputFormat && HTOutputFormat == WWW_SOURCE)) { + FREE(HTMainAnchor->UCStages); + } + + /* * This is more or less copied out of HTLoadFile(), except we don't * get a content encoding. This may be overkill. -dsb */ @@ -6828,6 +6868,14 @@ PUBLIC BOOLEAN HTreparse_document NOARGS (void *)HTMainAnchor->source_cache_chunk); /* + * This magic FREE(anchor->UCStages) call + * stolen from HTuncache_current_document() above. + */ + if (!(HTOutputFormat && HTOutputFormat == WWW_SOURCE)) { + FREE(HTMainAnchor->UCStages); + } + + /* * This is only done to make things aligned with SOURCE_CACHE_NONE and * SOURCE_CACHE_FILE when switching to source mode since the original * document's charset will be LYPushAssumed() and then LYPopAssumed(). @@ -6936,6 +6984,8 @@ PUBLIC BOOLEAN HTdocument_settings_changed NOARGS trace_setting_change("SOFT_DQUOTES", HTMainText->soft_dquotes, soft_dquotes); trace_setting_change("OLD_DTD", HTMainText->old_dtd, Old_DTD); + trace_setting_change("KEYPAD_MODE", + HTMainText->keypad_mode, keypad_mode); if (HTMainText->lines != LYlines || HTMainText->cols != LYcols) CTRACE(tfp, "HTdocument_settings_changed: Screen size has changed (was %dx%d, now %dx%d)\n", @@ -6944,12 +6994,13 @@ PUBLIC BOOLEAN HTdocument_settings_changed NOARGS return (HTMainText->clickable_images != clickable_images || HTMainText->pseudo_inline_alts != pseudo_inline_alts || - HTMainText->verbose_img != verbose_img || + HTMainText->verbose_img != verbose_img || HTMainText->raw_mode != LYUseDefaultRawMode || HTMainText->historical_comments != historical_comments || HTMainText->minimal_comments != minimal_comments || HTMainText->soft_dquotes != soft_dquotes || HTMainText->old_dtd != Old_DTD || + HTMainText->keypad_mode != keypad_mode || HTMainText->lines != LYlines || HTMainText->cols != LYcols); } @@ -10684,7 +10735,6 @@ PUBLIC int HText_ExtEditForm ARGS1( int newlines = 0; int len; - CTRACE(tfp, "GridText: entered HText_ExtEditForm()\n"); ed_temp = (char *) malloc (LY_MAXPATH); @@ -10822,6 +10872,9 @@ PUBLIC int HText_ExtEditForm ARGS1( else len = strlen (lp); + if (len >= MAX_LINE - 1) + len = MAX_LINE - 1; + strncpy (line, lp, len); *(line + len) = '\0'; diff --git a/src/GridText.h b/src/GridText.h index b8705e7a..5fb73f07 100644 --- a/src/GridText.h +++ b/src/GridText.h @@ -47,13 +47,6 @@ #define NOCHOP 0 #define CHOP 1 -#define TABSTOP 8 -#define SPACES " " /* must be at least TABSTOP spaces long */ -#define SPLAT '.' - -#define NOCHOP 0 -#define CHOP 1 - /* just for information: US-ASCII control characters <32 which are not defined in Unicode standard =00 U+0000 NULL diff --git a/src/HTAlert.c b/src/HTAlert.c index 0730e8a5..2200a58a 100644 --- a/src/HTAlert.c +++ b/src/HTAlert.c @@ -174,6 +174,38 @@ PUBLIC void HTProgress ARGS1( #endif } +#ifdef EXP_READPROGRESS +PRIVATE char *sprint_bytes ARGS3( + char *, s, + long, n, + char *, was_units) +{ + static long kb_units = 1024; + static char *bunits; + static char *kbunits; + char *u; + + if (!bunits) { + bunits = gettext("bytes"); + kbunits = gettext("KB"); + } + + u = kbunits; + if (LYshow_kb_rate && (n >= 10 * kb_units)) + sprintf(s, "%ld", n/kb_units); + else if (LYshow_kb_rate && (n >= kb_units)) + sprintf(s, "%.2g", ((double)n)/kb_units); + else { + sprintf(s, "%ld", n); + u = bunits; + } + + if (!was_units || was_units != u) + sprintf(s + strlen(s), " %s", u); + return u; +} +#endif /* EXP_READPROGRESS */ + /* Issue a read-progress message. HTReadProgress() ** ------------------------------ */ @@ -239,9 +271,90 @@ PUBLIC void HTReadProgress ARGS2( if (total < -1) strcat(line, " (Press 'z' to abort)"); } - _HTProgress(line); + statusline(line); + } +#else /* !WIN_EX */ +#ifdef EXP_READPROGRESS + static long bytes_last, total_last; + static long transfer_rate = 0; + char line[300], bytesp[80], totalp[80], transferp[80]; + int renew = 0; + char *was_units; +#if HAVE_GETTIMEOFDAY + struct timeval tv; + int dummy = gettimeofday(&tv, (struct timezone *)0); + double now = tv.tv_sec + tv.tv_usec/1000000. ; + static double first, last, last_active; +#else + time_t now = time((time_t *)0); /* once per second */ + static time_t first, last, last_active; +#endif + + if (bytes == 0) { + first = last = last_active = now; + bytes_last = bytes; + line[0] = 0; + } else if (bytes < 0) { /* stalled */ + bytes = bytes_last; + total = total_last; } + if ((bytes > 0) && + (now != first)) + /* 1 sec delay for transfer_rate calculation without g-t-o-d */ { + if (transfer_rate <= 0) /* the very first time */ + transfer_rate = (bytes) / (now - first); /* bytes/sec */ + total_last = total; + + /* + * Optimal refresh time: every 0.2 sec, use interpolation. Transfer + * rate is not constant when we have partial content in a proxy, so + * interpolation lies - will check every second at least for sure. + */ +#if HAVE_GETTIMEOFDAY + if (now >= last + 0.2) + renew = 1; #else + if (((bytes - bytes_last) > (transfer_rate / 5)) || (now != last)) { + renew = 1; + bytes_last += (transfer_rate / 5); /* until we got next second */ + } +#endif + if (renew) { + if (now != last) { + last = now; + if (bytes_last != bytes) + last_active = now; + bytes_last = bytes; + transfer_rate = bytes / (now - first); /* more accurate here */ + } + + if (total > 0) + was_units = sprint_bytes(totalp, total, 0); + else + was_units = 0; + sprint_bytes(bytesp, bytes, was_units); + sprint_bytes(transferp, transfer_rate, 0); + + if (total > 0) + sprintf (line, gettext("Read %s of %s of data"), bytesp, totalp); + else + sprintf (line, gettext("Read %s of data"), bytesp); + if (transfer_rate > 0) + sprintf (line + strlen(line), gettext(", %s/sec"), transferp); + if (now - last_active >= 5) + sprintf (line + strlen(line), gettext(" (stalled for %ld sec)"), (long)(now - last_active)); + if (total > 0 && transfer_rate) + sprintf (line + strlen(line), gettext(", ETA %ld sec"), (long)((total - bytes)/transfer_rate)); + sprintf (line + strlen(line), "."); + if (total < -1) + strcat(line, gettext(" (Press 'z' to abort)")); + + /* do not store the message for history page. */ + statusline(line); + CTRACE(tfp, "%s\n", line); + } + } +#else /* !EXP_READPROGRESS */ static long kb_units = 1024; static time_t first, last; static long bytes_last; @@ -304,7 +417,8 @@ PUBLIC void HTReadProgress ARGS2( CTRACE(tfp, "%s\n", line); } } -#endif +#endif /* EXP_READPROGRESS */ +#endif /* WIN_EX */ } PRIVATE BOOL conf_cancelled = NO; /* used by HTConfirm only - kw */ diff --git a/src/HTFWriter.c b/src/HTFWriter.c index fd1f4bd5..68d4b1de 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -312,7 +312,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) stop_curses(); #endif } -#ifdef _WIN_CC +#if _WIN_CC exec_command(me->end_command, FALSE); #else LYSystem(me->end_command); @@ -368,7 +368,7 @@ PRIVATE void HTFWriter_free ARGS1(HTStream *, me) stop_curses(); #endif } -#ifdef _WIN_CC +#if _WIN_CC exec_command(me->end_command, FALSE); #else LYSystem(me->end_command); diff --git a/src/HTForms.h b/src/HTForms.h index 53cde123..eb746376 100644 --- a/src/HTForms.h +++ b/src/HTForms.h @@ -6,12 +6,22 @@ #endif /* LYSTRUCTS_H */ /* in LYForms.c */ + +/* change_form_link calls change_form_link_ex with all its args and FALSE as + last arg */ extern int change_form_link PARAMS((struct link *form_link, - document *newdoc, BOOLEAN *refresh_screen, + document *newdoc, BOOLEAN *refresh_screen, char *link_name, char *link_value, BOOLEAN use_last_tfpos, BOOLEAN immediate_submit)); +extern int change_form_link_ex PARAMS((struct link *form_link, + document *newdoc, BOOLEAN *refresh_screen, + char *link_name, char *link_value, + BOOLEAN use_last_tfpos, + BOOLEAN immediate_submit, + BOOLEAN draw_only)); + /* InputFieldData is used to pass the info between * HTML.c and Gridtext.c in HText_beginInput() */ @@ -29,15 +39,15 @@ typedef struct _InputFieldData { CONST char *maxlength; CONST char *md; CONST char *min; - CONST char *name; + CONST char *name; CONST char *size; CONST char *src; CONST char *type; char *value; CONST char *width; - int name_cs; /* charset handle for name */ - int value_cs; /* charset handle for value */ - CONST char *accept_cs; + int name_cs; /* charset handle for name */ + int value_cs; /* charset handle for value */ + CONST char *accept_cs; } InputFieldData; /* The OptionType structure is for a linked list of option entries @@ -68,18 +78,18 @@ typedef struct _FormInfo { int hrange; /* high numerical range */ int lrange; /* low numerical range */ OptionType * select_list; /* array of option choices */ - char * submit_action; /* form's action */ - int submit_method; /* form's method */ - char * submit_enctype; /* form's entype */ + char * submit_action; /* form's action */ + int submit_method; /* form's method */ + char * submit_enctype; /* form's entype */ char * submit_title; /* form's title */ BOOL no_cache; /* Always resubmit? */ char * cp_submit_value; /* option value to submit */ - char * orig_submit_value; /* original submit value */ + char * orig_submit_value; /* original submit value */ int size_l; /* The length of the option list */ int disabled; /* If YES, can't change values */ - int name_cs; - int value_cs; - char * accept_cs; + int name_cs; + int value_cs; + char * accept_cs; } FormInfo; /* @@ -95,12 +105,12 @@ typedef struct _PerFormInfo int number; /* form number, see GridText.c */ /* except for the last two, the followign fields aren't actually used.. */ int disabled; /* If YES, can't change values */ - struct _PerFormInfo * next; /* pointer to next form in doc */ - int nfields; /* number of fields */ - FormInfo * first_field; - FormInfo * last_field; /* pointer to last field in form */ - char * accept_cs; - char * thisacceptcs; /* used during submit */ + struct _PerFormInfo * next; /* pointer to next form in doc */ + int nfields; /* number of fields */ + FormInfo * first_field; + FormInfo * last_field; /* pointer to last field in form */ + char * accept_cs; + char * thisacceptcs; /* used during submit */ } PerFormInfo; #define HYPERTEXT_ANCHOR 1 diff --git a/src/HTML.c b/src/HTML.c index 6fda07e9..d6c0370a 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -526,6 +526,18 @@ PUBLIC void HTML_put_string ARGS2(HTStructured *, me, CONST char *, s) * by the cases above (HTML_PRE or similar may not be the * last element pushed on the style stack). - kw */ +#ifdef USE_PSRC + if (psrc_view) { + /* + * We do this so that a raw '\r' in the string will not be + * interpreted as an internal request to break a line - passing + * '\r' to HText_appendText is treated by it as a request to + * insert a blank line - VH + */ + for(; *s; ++s) + HTML_put_character(me, *s); + } else +#endif HText_appendText(me->text, s); break; } else { @@ -734,7 +746,7 @@ PRIVATE void HTMLSRC_apply_markup ARGS4( # define START TRUE # define STOP FALSE -#ifdef __STDC__ +#if defined(__STDC__) || _WIN_CC # define PSRCSTART(x) HTMLSRC_apply_markup(me,HTL_##x,START,tag_charset) # define PSRCSTOP(x) HTMLSRC_apply_markup(me,HTL_##x,STOP,tag_charset) #else @@ -1631,6 +1643,7 @@ PRIVATE void HTML_start_element ARGS6( if (me->inUnderline == FALSE) HText_appendCharacter(me->text, LY_UNDERLINE_END_CHAR); HTML_put_character(me, ' '); + me->in_word = NO; CHECK_ID(HTML_FRAME_ID); HText_beginAnchor(me->text, me->inUnderline, me->CurrentA); @@ -5709,12 +5722,19 @@ PRIVATE void HTML_start_element ARGS6( me->sp[0].style = me->new_style; /* Stack new style */ me->sp[0].tag_number = ElementNumber; #ifdef EXP_JUSTIFY_ELTS - if (wait_for_this_stacked_elt<0 && - HTML_dtd.tags[ElementNumber].can_justify==FALSE) - wait_for_this_stacked_elt=me->stack - me->sp; + if (wait_for_this_stacked_elt < 0 && + HTML_dtd.tags[ElementNumber].can_justify == FALSE) + wait_for_this_stacked_elt = me->stack - me->sp + MAX_NESTING; #endif } +#ifdef EXP_JUSTIFY_ELTS + if (in_DT && ElementNumber == HTML_DD) + in_DT = FALSE; + else if (ElementNumber == HTML_DT) + in_DT = TRUE; +#endif + #if defined(USE_COLOR_STYLE) /* end really empty tags straight away */ #define REALLY_EMPTY(e) ((HTML_dtd.tags[e].contents == SGML_EMPTY) && \ @@ -5889,8 +5909,8 @@ PRIVATE void HTML_end_element ARGS3( return; } else if (me->sp < (me->stack + MAX_NESTING - 1)) { #ifdef EXP_JUSTIFY_ELTS - if (wait_for_this_stacked_elt==me->stack-me->sp) - reached_awaited_stacked_elt=TRUE; + if (wait_for_this_stacked_elt == me->stack - me->sp + MAX_NESTING) + reached_awaited_stacked_elt = TRUE; #endif (me->sp)++; CTRACE(tfp, "HTML:end_element[%d]: Popped style off stack - %s\n", @@ -6271,6 +6291,10 @@ PRIVATE void HTML_end_element ARGS3( me->List_Nesting_Level--; CTRACE(tfp, "HTML_end_element: Reducing List Nesting Level to %d\n", me->List_Nesting_Level); +#ifdef EXP_JUSTIFY_ELTS + if (element_number == HTML_DL) + in_DT = FALSE; /*close the term that was without definition. */ +#endif change_paragraph_style(me, me->sp->style); /* Often won't really change */ UPDATE_STYLE; if (me->List_Nesting_Level >= 0) @@ -7832,19 +7856,6 @@ PUBLIC HTStructured* HTML_new ARGS3( me->outUCLYhndl, me->outUCI); #endif -#ifdef EXP_JUSTIFY_ELTS - wait_for_this_stacked_elt = !ok_justify -# ifdef USE_PSRC - || psrc_view -# endif - ? MAX_NESTING+2 /*some unreachable value*/ : -1; - can_justify_here = TRUE; - can_justify_this_line = TRUE; - form_in_htext = FALSE; - - ht_justify_cleanup(); -#endif - me->target = stream; if (stream) me->targetClass = *stream->isa; /* Copy pointers */ diff --git a/src/LYBookmark.c b/src/LYBookmark.c index 50ad92bd..e07799eb 100644 --- a/src/LYBookmark.c +++ b/src/LYBookmark.c @@ -281,10 +281,10 @@ PUBLIC void save_bookmark_link ARGS2( if (HTCJK == JAPANESE) { switch(kanji_code) { case EUC: - TO_EUC(title, tmp_buffer); + TO_EUC((CONST unsigned char *) title, (unsigned char *) tmp_buffer); break; case SJIS: - TO_SJIS(title, tmp_buffer); + TO_SJIS((CONST unsigned char *) title, (unsigned char *) tmp_buffer); break; default: break; @@ -316,13 +316,13 @@ PUBLIC void save_bookmark_link ARGS2( if (HTCJK == JAPANESE) { switch(kanji_code) { /* 1997/11/22 (Sat) 09:28:00 */ case EUC: - TO_EUC(string_buffer, tmp_buffer); + TO_EUC((CONST unsigned char *) string_buffer, (unsigned char *) tmp_buffer); break; case SJIS: - TO_SJIS(string_buffer, tmp_buffer); + TO_SJIS((CONST unsigned char *) string_buffer, (unsigned char *) tmp_buffer); break; default: - TO_JIS(string_buffer, tmp_buffer); + TO_JIS((CONST unsigned char *) string_buffer, (unsigned char *) tmp_buffer); break; } StrAllocCopy(Title, tmp_buffer); diff --git a/src/LYCookie.c b/src/LYCookie.c index a3640e32..ea5bd4d3 100644 --- a/src/LYCookie.c +++ b/src/LYCookie.c @@ -629,7 +629,9 @@ PRIVATE char * scan_cookie_sublist ARGS6( co = (cookie *)hl->object; next = hl->next; - if (co) { + if ((co) && /* speed-up host_matches() and limit trace output */ + (LYstrstr((char *)hostname, co->domain) != NULL)) + { CTRACE(tfp, "Checking cookie %p %s=%s\n", hl, (co->name ? co->name : "(no name)"), diff --git a/src/LYCurses.c b/src/LYCurses.c index 679c2f99..e554c2d7 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -938,14 +938,18 @@ PUBLIC void lynx_enable_mouse ARGS1(int,state) /* Inform ncurses which mouse events we're interested in. * We shouldn't need to include BUTTONn_PRESSED and BUTTONn_RELEASED * events, since ncurses should translate them to click events. - kw + * However, if we do not include them, then ncurses effectively + * ignores mouseinterval(), thus translates *any* sequence of + * press/release to a click, which leads to inconveniences. + * We special-case these events in LYStrings.c. */ mousemask(BUTTON_CTRL | BUTTON_ALT - /* | BUTTON1_PRESSED | BUTTON1_RELEASED */ + | BUTTON1_PRESSED | BUTTON1_RELEASED | BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED | BUTTON1_TRIPLE_CLICKED - /* | BUTTON2_PRESSED | BUTTON2_RELEASED */ + | BUTTON2_PRESSED | BUTTON2_RELEASED | BUTTON2_CLICKED - /* | BUTTON3_PRESSED | BUTTON3_RELEASED */ + | BUTTON3_PRESSED | BUTTON3_RELEASED | BUTTON3_CLICKED | BUTTON3_DOUBLE_CLICKED | BUTTON3_TRIPLE_CLICKED, NULL); diff --git a/src/LYCurses.h b/src/LYCurses.h index 3b252afa..eefeeeaa 100644 --- a/src/LYCurses.h +++ b/src/LYCurses.h @@ -111,7 +111,11 @@ extern void LYsubwindow PARAMS((WINDOW * param)); # if defined(VMS) && defined(__GNUC__) # include <LYGCurses.h> # else -# include <curses.h> /* everything else */ +# ifdef PDCURSES /* 1999/07/15 (Thu) 08:27:48 */ +# include <pdcurses.h> /* for PDCurses */ +# else +# include <curses.h> /* everything else */ +# endif /* not PDCURSES */ # endif /* VMS && __GNUC__ */ #endif /* HAVE_CONFIG_H */ @@ -430,4 +434,14 @@ extern void lynx_stop_all_colors NOPARAMS; #define SetDefaultMode(mode) /* nothing */ #endif +/* + * Very old versions of curses cannot put the cursor on the lower right corner. + * Adjust our "hidden" cursor position accordingly. + */ +#if defined(FANCY_CURSES) || defined(USE_SLANG) +#define LYHideCursor() move((LYlines - 1), (LYcols - 1)) +#else +#define LYHideCursor() move((LYlines - 1), (LYcols - 2)) +#endif + #endif /* LYCURSES_H */ diff --git a/src/LYForms.c b/src/LYForms.c index 574a857a..282adc91 100644 --- a/src/LYForms.c +++ b/src/LYForms.c @@ -24,7 +24,8 @@ extern HTCJKlang HTCJK; PRIVATE int form_getstr PARAMS(( struct link * form_link, - BOOLEAN use_last_tfpos)); + BOOLEAN use_last_tfpos, + BOOLEAN redraw_only)); PRIVATE int popup_options PARAMS(( int cur_selection, OptionType * list, @@ -34,14 +35,16 @@ PRIVATE int popup_options PARAMS(( int i_length, int disabled)); -PUBLIC int change_form_link ARGS7( + +PUBLIC int change_form_link_ex ARGS8( struct link *, form_link, document *, newdoc, BOOLEAN *, refresh_screen, char *, link_name, char *, link_value, BOOLEAN, use_last_tfpos, - BOOLEAN, immediate_submit) + BOOLEAN, immediate_submit, + BOOLEAN, redraw_only) { FormInfo *form = form_link->form; int newdoc_changed = 0; @@ -179,7 +182,7 @@ PUBLIC int change_form_link ARGS7( case F_TEXT_TYPE: case F_TEXTAREA_TYPE: case F_PASSWORD_TYPE: - c = form_getstr(form_link, use_last_tfpos); + c = form_getstr(form_link, use_last_tfpos, redraw_only); if (form->type == F_PASSWORD_TYPE) form_link->hightext = STARS(strlen(form->value)); else @@ -194,8 +197,12 @@ PUBLIC int change_form_link ARGS7( break; case F_TEXT_SUBMIT_TYPE: + if (redraw_only) { + c = form_getstr(form_link, use_last_tfpos, TRUE); + break; + } if (!immediate_submit) - c = form_getstr(form_link, use_last_tfpos); + c = form_getstr(form_link, use_last_tfpos, FALSE); if (form->disabled == YES && (c == '\r' || c == '\n' || immediate_submit)) { if (peek_mouse_link() >= 0) @@ -300,6 +307,20 @@ PUBLIC int change_form_link ARGS7( return(c); } +PUBLIC int change_form_link ARGS7( + struct link *, form_link, + document *, newdoc, + BOOLEAN *, refresh_screen, + char *, link_name, + char *, link_value, + BOOLEAN, use_last_tfpos, + BOOLEAN, immediate_submit) +{ + /*pass all our args and FALSE as last arg*/ + return change_form_link_ex(form_link,newdoc,refresh_screen,link_name, + link_value,use_last_tfpos,immediate_submit, FALSE /*redraw_only*/ ); +} + PRIVATE int LastTFPos = -1; /* remember last text field position */ PRIVATE void LYSetLastTFPos ARGS1( @@ -307,16 +328,11 @@ PRIVATE void LYSetLastTFPos ARGS1( { LastTFPos = pos; } -#if 0 -PRIVATE int LYLastTFPos NOARGS -{ - return(LastTFPos); -} -#endif /* 0 */ -PRIVATE int form_getstr ARGS2( +PRIVATE int form_getstr ARGS3( struct link *, form_link, - BOOLEAN, use_last_tfpos) + BOOLEAN, use_last_tfpos, + BOOLEAN, redraw_only) { FormInfo *form = form_link->form; char *value = form->value; @@ -363,33 +379,6 @@ PRIVATE int form_getstr ARGS2( */ HTUserMsg(FORM_VALUE_TOO_LONG); show_formlink_statusline(form); -#if 0 /* using function above instead */ - switch(form->type) { - case F_PASSWORD_TYPE: - statusline(FORM_LINK_PASSWORD_MESSAGE); - break; - case F_TEXT_SUBMIT_TYPE: - if (form->submit_method == URL_MAIL_METHOD) { - statusline(FORM_LINK_TEXT_SUBMIT_MAILTO_MSG); - } else if (form->no_cache) { - statusline(FORM_LINK_TEXT_RESUBMIT_MESSAGE); - } else { - statusline(FORM_LINK_TEXT_SUBMIT_MESSAGE); - } - break; - case F_FILE_TYPE: - statusline(FORM_LINK_FILE_MESSAGE); - break; - case F_TEXT_TYPE: - statusline(FORM_LINK_TEXT_MESSAGE); - break; - case F_TEXTAREA_TYPE: - statusline(FORM_LINK_TEXTAREA_MESSAGE); - break; - default: - break; - } -#endif /* 0 - using function instead */ move(startline, startcol); } } @@ -413,6 +402,8 @@ PRIVATE int form_getstr ARGS2( MyEdit.pos = 0; } LYRefreshEdit(&MyEdit); + if (redraw_only) + return 0; /*return value won't be analysed*/ /* * And go for it! @@ -420,7 +411,7 @@ PRIVATE int form_getstr ARGS2( for (;;) { again: repeat = -1; - get_mouse_link(); /* Reset mouse_link. */ + get_mouse_link(); /* Reset mouse_link. */ ch = LYgetch_for(FOR_INPUT); #ifdef SUPPORT_MULTIBYTE_EDIT diff --git a/src/LYGlobalDefs.h b/src/LYGlobalDefs.h index 2bbe13f1..5f3c0da9 100644 --- a/src/LYGlobalDefs.h +++ b/src/LYGlobalDefs.h @@ -118,70 +118,71 @@ extern BOOLEAN LYUseFormsOptions; /* use Forms-based options menu */ #else #define LYUseFormsOptions FALSE /* simplify ifdef'ing in LYMainLoop.c */ #endif + +extern BOOLEAN LYCursesON; /* start_curses()->TRUE, stop_curses()->FALSE */ +extern BOOLEAN LYJumpFileURL; /* URL from the jump file shortcuts? */ +extern BOOLEAN LYNewsPosting; /* News posting supported if TRUE */ extern BOOLEAN LYShowCursor; /* Show the cursor or hide it? */ -extern BOOLEAN verbose_img; /* display filenames of images? */ extern BOOLEAN LYUseDefShoCur; /* Command line -show_cursor toggle */ -extern BOOLEAN LYCursesON; /* start_curses()->TRUE, stop_curses()->FALSE */ extern BOOLEAN LYUserSpecifiedURL; /* URL from a goto or document? */ -extern BOOLEAN LYJumpFileURL; /* URL from the jump file shortcuts? */ -extern BOOLEAN jump_buffer; /* TRUE if offering default shortcut */ +extern BOOLEAN LYforce_HTML_mode; +extern BOOLEAN LYforce_no_cache; +extern BOOLEAN LYinternal_flag; /* don't need fresh copy, was internal link */ +extern BOOLEAN LYoverride_no_cache; /* don't need fresh copy, from history */ +extern BOOLEAN LYresubmit_posts; +extern BOOLEAN LYshow_kb_rate; /* show KB/sec in HTReadProgress */ +extern BOOLEAN bold_H1; +extern BOOLEAN bold_headers; +extern BOOLEAN bold_name_anchors; +extern BOOLEAN case_sensitive; /* TRUE to turn on case sensitive search */ +extern BOOLEAN check_mail; /* TRUE to report unread/new mail messages */ +extern BOOLEAN child_lynx; /* TRUE to exit with an arrow */ +extern BOOLEAN dump_output_immediately; +extern BOOLEAN emacs_keys; /* TRUE to turn on emacs-like key movement */ +extern BOOLEAN error_logging; /* TRUE to mail error messages */ +extern BOOLEAN ftp_ok; extern BOOLEAN goto_buffer; /* TRUE if offering default goto URL */ -extern char *LYRequestTitle; /* newdoc.title in calls to getfile() */ -extern char *jumpprompt; /* The default jump statusline prompt */ -extern int more; /* is there more document to display? */ -extern int display_lines; /* number of lines in the display */ -extern int www_search_result; -extern char *checked_box; /* form boxes */ -extern char *unchecked_box; /* form boxes */ -extern char *checked_radio; /* form radio buttons */ -extern char *unchecked_radio; /* form radio buttons */ -extern char *empty_string; +extern BOOLEAN is_www_index; +extern BOOLEAN jump_buffer; /* TRUE if offering default shortcut */ +extern BOOLEAN long_url_ok; +extern BOOLEAN lynx_mode; +extern BOOLEAN news_ok; +extern BOOLEAN recent_sizechange; +extern BOOLEAN rlogin_ok; +extern BOOLEAN system_editor; /* True if locked-down editor */ +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 *LynxHome; -extern char *original_dir; -extern char *startfile; +extern char *LynxSigFile; /* Signature file, in or off home */ +extern char *checked_box; /* form boxes */ +extern char *checked_radio; /* form radio buttons */ +extern char *empty_string; extern char *helpfile; extern char *helpfilepath; +extern char *jumpprompt; /* The default jump statusline prompt */ +extern char *language; +extern char *lynx_cfg_file; /* location of active lynx.cfg file */ +extern char *lynx_save_space; +extern char *lynx_temp_space; extern char *lynxjumpfile; -extern char *lynxlistfile; extern char *lynxlinksfile; -extern char *x_display; -extern char *language; +extern char *lynxlistfile; +extern char *original_dir; extern char *pref_charset; /* Lynx's preferred character set - MM */ -extern BOOLEAN LYNewsPosting; /* News posting supported if TRUE */ -extern char *LynxSigFile; /* Signature file, in or off home */ +extern char *startfile; extern char *system_mail; extern char *system_mail_flags; -extern char *lynx_cfg_file; /* location of active lynx.cfg file */ -extern char *lynx_temp_space; -extern char *lynx_save_space; -extern BOOLEAN LYforce_HTML_mode; -extern BOOLEAN LYforce_no_cache; -extern BOOLEAN LYoverride_no_cache; /* don't need fresh copy, from history */ -extern BOOLEAN LYinternal_flag; /* don't need fresh copy, was internal link */ -extern BOOLEAN LYresubmit_posts; -extern BOOLEAN LYshow_kb_rate; /* show KB/sec in HTReadProgress */ -extern int user_mode; /* novice or advanced */ -extern BOOLEAN is_www_index; -extern BOOLEAN dump_output_immediately; +extern char *unchecked_box; /* form boxes */ +extern char *unchecked_radio; /* form radio buttons */ +extern char *x_display; +extern int display_lines; /* number of lines in the display */ extern int dump_output_width; -extern BOOLEAN lynx_mode; -extern BOOLEAN bold_headers; -extern BOOLEAN bold_H1; -extern BOOLEAN bold_name_anchors; -extern BOOLEAN recent_sizechange; -extern BOOLEAN telnet_ok; -extern BOOLEAN news_ok; -extern BOOLEAN ftp_ok; -extern BOOLEAN rlogin_ok; -extern BOOLEAN system_editor; /* True if locked-down editor */ -extern BOOLEAN child_lynx; /* TRUE to exit with an arrow */ -extern BOOLEAN error_logging; /* TRUE to mail error messages */ -extern BOOLEAN check_mail; /* TRUE to report unread/new mail messages */ -extern BOOLEAN vi_keys; /* TRUE to turn on vi-like key movement */ -extern BOOLEAN emacs_keys; /* TRUE to turn on emacs-like key movement */ -extern int keypad_mode; /* is set to either NUMBERS_AS_ARROWS * - * or LINKS_ARE_NUMBERED */ -extern BOOLEAN case_sensitive; /* TRUE to turn on case sensitive search */ +extern int keypad_mode; /* NUMBERS_AS_ARROWS or LINKS_ARE_NUMBERED */ +extern int more; /* is there more document to display? */ +extern int user_mode; /* novice or advanced */ +extern int www_search_result; extern BOOLEAN had_restrictions_default; /* flags to note whether we have... */ extern BOOLEAN had_restrictions_all; /* parsed these restriction options */ @@ -398,6 +399,12 @@ extern BOOLEAN with_backspaces; extern BOOL force_empty_hrefless_a; #endif +#ifndef NO_NONSTICKY_INPUTS +extern BOOL sticky_inputs; +extern BOOL textinput_drawn; +#endif + + #ifndef VMS extern BOOLEAN LYNoCore; extern BOOLEAN restore_sigpipe_for_children; diff --git a/src/LYJustify.h b/src/LYJustify.h index fb800bc2..7ecbd840 100644 --- a/src/LYJustify.h +++ b/src/LYJustify.h @@ -17,6 +17,10 @@ extern BOOL can_justify_this_line; extern int wait_for_this_stacked_elt; extern BOOL form_in_htext; + /*this is the element with SGML_EMPTY content, so it won't + get on the stack, so we can't trap it with wait_for_this_stacked_elt */ +extern BOOL in_DT; + /*disabled by default*/ /*#define DEBUG_JUSTIFY*/ #ifdef DEBUG_JUSTIFY diff --git a/src/LYLocal.c b/src/LYLocal.c index 58eacbfb..f2616fb1 100644 --- a/src/LYLocal.c +++ b/src/LYLocal.c @@ -796,7 +796,7 @@ PUBLIC BOOLEAN local_modify ARGS2( #ifdef OK_PERMIT _statusline(gettext("Modify name, location, or permission (n, l, or p): ")); #else - _statusline(gettext("Modify name, or location (n or l): ")); + _statusline(gettext("Modify name or location (n or l): ")); #endif /* OK_PERMIT */ c = LYgetch(); ans = TOUPPER(c); @@ -1359,7 +1359,7 @@ PUBLIC void tagflag ARGS2( #if defined(FANCY_CURSES) || defined(USE_SLANG) if (!LYShowCursor) - move((LYlines - 1), (LYcols - 1)); /* get cursor out of the way */ + LYHideCursor(); /* get cursor out of the way */ else #endif /* FANCY CURSES || USE_SLANG */ /* diff --git a/src/LYMain.c b/src/LYMain.c index 84a9ab1c..b2a82c6b 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -197,6 +197,7 @@ PUBLIC BOOLEAN telnet_ok = TRUE; PUBLIC BOOLEAN news_ok = TRUE; #endif PUBLIC BOOLEAN rlogin_ok = TRUE; +PUBLIC BOOLEAN long_url_ok = TRUE; PUBLIC BOOLEAN ftp_ok = TRUE; PUBLIC BOOLEAN system_editor = FALSE; @@ -443,6 +444,10 @@ PUBLIC BOOLEAN with_backspaces = FALSE; PUBLIC BOOL force_empty_hrefless_a = FALSE; #endif +#ifndef NO_NONSTICKY_INPUTS +PUBLIC BOOL sticky_inputs = TRUE; +#endif + #ifdef DISP_PARTIAL PUBLIC BOOLEAN display_partial_flag = TRUE; /* Display document during download */ PUBLIC BOOLEAN debug_display_partial = FALSE; /* Show with MessageSecs delay */ @@ -2066,7 +2071,8 @@ PUBLIC void reload_read_cfg NOARGS /* set few safe flags: */ #ifdef EXP_PERSISTENT_COOKIES BOOLEAN persistent_cookies_flag = persistent_cookies; - char * LYCookieFile_flag = LYCookieFile; + char * LYCookieFile_flag = NULL; + StrAllocCopy(LYCookieFile_flag, LYCookieFile); #endif free_lynx_cfg(); /* free downloaders, printers, not always environments */ @@ -2104,14 +2110,15 @@ PUBLIC void reload_read_cfg NOARGS */ #ifdef EXP_PERSISTENT_COOKIES /* restore old settings */ - if (persistent_cookies != persistent_cookies_flag) { - persistent_cookies = persistent_cookies_flag; - HTAlert(gettext("persistent cookies state will be changed in next session only.")); - } - if (strcmp(LYCookieFile, LYCookieFile_flag)) { - StrAllocCopy(LYCookieFile, LYCookieFile_flag); - CTRACE(tfp, "cookies file can be changed in next session only, restored.\n"); - } + if (persistent_cookies != persistent_cookies_flag) { + persistent_cookies = persistent_cookies_flag; + HTAlert(gettext("persistent cookies state will be changed in next session only.")); + } + if (strcmp(LYCookieFile, LYCookieFile_flag)) { + StrAllocCopy(LYCookieFile, LYCookieFile_flag); + CTRACE(tfp, "cookies file can be changed in next session only, restored.\n"); + } + FREE(LYCookieFile_flag); #endif } @@ -3239,6 +3246,10 @@ with the PREV_DOC command or from the History List" "selective", FUNCTION_ARG, selective_fun, "require .www_browsable files to browse directories" ), + PARSE_SET( + "short_url", UNSET_ARG, &long_url_ok, + "enables examination of beginning and end of long URL in status line" + ), #ifdef SH_EX PARSE_SET( "show_cfg", SET_ARG, &show_cfg, @@ -3266,6 +3277,12 @@ treated '>' as a co-terminator for double-quotes and tags" "startfile_ok", SET_ARG, &startfile_ok, "allow non-http startfile and homepage with -validate" ), +#ifndef NO_NONSTICKY_INPUTS + PARSE_SET( + "sticky_inputs", SET_ARG, &sticky_inputs, + "don't require activating inputs in order to edit them" + ), +#endif #ifndef VMS #ifdef SYSLOG_REQUESTED_URLS PARSE_STR( diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index 3d7a737f..3de3a451 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -46,6 +46,7 @@ extern char *string_short(char *str, int cut_pos); /* LYExtern.c */ #define CHARSET_TRANS 14 /* "Transparent" in LYCharSets.c */ +#ifdef SH_EX PRIVATE char *str_sjis(char *to, char *from) { if (!LYRawMode) { @@ -59,6 +60,7 @@ PRIVATE char *str_sjis(char *to, char *from) } return to; } +#endif PUBLIC char *str_kcode(HTkcode code) { @@ -110,12 +112,14 @@ PUBLIC char *str_kcode(HTkcode code) } -PUBLIC void set_ws_title(char * str) +#ifdef SH_EX +PRIVATE void set_ws_title(char * str) { #ifdef WIN_EX SetConsoleTitle(str); #endif } +#endif /* 1998/10/30 (Fri) 10:06:47 */ @@ -125,7 +129,7 @@ PRIVATE int str_n_cmp(const char *p, const char *q, int n) { if (n == 0) return 0; - + if (p == NULL) return NOT_EQU; @@ -158,6 +162,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 BOOL confirm_post_resub PARAMS(( CONST char* address, @@ -199,6 +204,12 @@ PRIVATE document curdoc; PRIVATE char *traversal_host = NULL; PRIVATE char *traversal_link_to_add = NULL; +#ifndef NO_NONSTICKY_INPUTS +PRIVATE BOOL textinput_activated = FALSE; +PUBLIC BOOL textinput_drawn = FALSE; + /*must be public since used in highlight(..)*/ +#endif + #ifdef LY_FIND_LEAKS /* * Function for freeing allocated mainloop() variables. - FM @@ -358,6 +369,36 @@ PRIVATE int do_change_link ARGS1( return(0); /* indicates OK */ } +PRIVATE int find_link_near_col ARGS2( + int, col, + int, delta) +{ + int i; + + for (i = curdoc.link; delta > 0 ? (i < nlinks) : (i >= 0); i += delta) { + if ( (links[i].ly - links[curdoc.link].ly) * delta > 0 ) { + int cy = links[i].ly, best = -1, dist = 1000000; + + while ((delta > 0 ? (i < nlinks) : (i >= 0)) && cy == links[i].ly) { + int cx = links[i].lx; + + if (links[i].hightext) + cx += strlen(links[i].hightext)/2; + cx -= col; + if (cx < 0) + cx = -cx; + if (cx < dist) { + dist = cx; + best = i; + } + i += delta; + } + return(best); + } + } + return(-1); +} + /* * Here's where we do all the work. * mainloop is basically just a big switch dependent on the users input. @@ -412,6 +453,7 @@ int mainloop NOARGS unsigned int len; int i; int n; + int follow_col = -1; #ifdef DIRED_SUPPORT char *tp = NULL; @@ -530,7 +572,7 @@ initialize: force_load = FALSE; /* done */ if (TRACE && LYCursesON) { - move(LYlines-1, LYcols-1); /* make sure cursor is down */ + LYHideCursor(); /* make sure cursor is down */ #ifdef USE_SLANG addstr("\n"); #endif /* USE_SLANG */ @@ -742,6 +784,10 @@ try_again: getresult = getfile(&newdoc); #endif /* TRACK_INTERNAL_LINKS */ +#ifndef NO_NOSTICKY_INPUTS + textinput_drawn = FALSE; /* for sure */ +#endif + switch(getresult) { case NOT_FOUND: @@ -1265,7 +1311,7 @@ try_again: * WINDOW structures are already filled based on the old size. * So we notify the ncurses library directly here. - kw */ -#if defined(NCURSES_VERSION) && !defined(PDCURSES) /* FIXME: check for specific version? */ +#if defined(HAVE_RESIZETERM) resizeterm(LYlines, LYcols); #else stop_curses(); @@ -1453,7 +1499,9 @@ try_again: * All display_partial calls ends here for final redraw. */ if (curdoc.line != Newline) { - +#ifndef NO_NONSTICKY_INPUTS + textinput_drawn = FALSE; +#endif refresh_screen = FALSE; HText_pageDisplay(Newline, prev_target); @@ -1644,11 +1692,12 @@ try_again: if (!(nlinks > 0 && links[curdoc.link].type == WWW_FORM_LINK_TYPE && (links[curdoc.link].form->type == F_TEXT_TYPE || - links[curdoc.link].form->type == F_TEXTAREA_TYPE))) + links[curdoc.link].form->type == F_TEXTAREA_TYPE))) { /* * Highlight current link. */ highlight(ON, curdoc.link, prev_target); + } if (traversal) { /* @@ -1688,6 +1737,9 @@ try_again: * Normal, non-traversal handling. */ if (nlinks > 0 && +#ifndef NO_NONSTICKY_INPUTS + (textinput_activated || !textinput_drawn) && +#endif links[curdoc.link].type == WWW_FORM_LINK_TYPE && (links[curdoc.link].form->type == F_TEXT_TYPE || links[curdoc.link].form->type == F_TEXT_SUBMIT_TYPE || @@ -1695,6 +1747,23 @@ try_again: links[curdoc.link].form->type == F_TEXTAREA_TYPE)) { BOOLEAN use_last_tfpos; + use_last_tfpos = (real_cmd == LYK_LPOS_PREV_LINK || + real_cmd == LYK_LPOS_NEXT_LINK); + +#ifndef NO_NONSTICKY_INPUTS + if (!sticky_inputs && !textinput_activated) { + /*draw the text entry, but don't activate it*/ + change_form_link_ex(&links[curdoc.link], + &newdoc, &refresh_screen, + links[curdoc.link].form->name, + links[curdoc.link].form->value, + use_last_tfpos, FALSE, TRUE); + c = DO_NOTHING; + textinput_drawn = TRUE; + } else +#endif + { + /* * Replace novice lines if in NOVICE_MODE. */ @@ -1704,13 +1773,15 @@ try_again: move(LYlines-1,0); clrtoeol(); addstr(FORM_NOVICELINE_TWO); } - use_last_tfpos = (real_cmd==LYK_LPOS_PREV_LINK || - real_cmd==LYK_LPOS_NEXT_LINK); real_c = change_form_link(&links[curdoc.link], &newdoc, &refresh_screen, links[curdoc.link].form->name, links[curdoc.link].form->value, use_last_tfpos, FALSE); +#ifndef NO_NONSTICKY_INPUTS + textinput_activated = FALSE; + textinput_drawn = FALSE; +#endif c = (real_c==LKC_DONE) ? DO_NOTHING : LKC_TO_C(real_c); if (c != DO_NOTHING && @@ -1782,6 +1853,13 @@ try_again: newdoc.link++; } } +#ifndef NO_NONSTICKY_INPUTS + if (!sticky_inputs) { + textinput_activated = TRUE; + textinput_drawn = TRUE; + }; +#endif + } #endif /* AUTOGROW */ @@ -1794,9 +1872,11 @@ try_again: c = LAC_TO_LKC0(LYK_NEXT_LINK); break; default: + if (old_c != c && old_c != real_c && c != real_c) real_c = c; } + } /* !(!sticky_inputs && !textinput_activated)*/ } else { /* * Get a keystroke from the user. @@ -1930,7 +2010,7 @@ new_keyboard_input: #ifdef WIN_EX if (c == DO_NOTHING) cmd = LYK_DO_NOTHING; - else + else #endif cmd = LKC_TO_LAC(keymap,c); /* adds 1 to map EOF to 0 */ @@ -1949,6 +2029,9 @@ new_cmd: /* force_old_UCLYhndl_on_reload = FALSE; CTRACE_FLUSH(tfp); + if (cmd != LYK_UP_LINK && cmd != LYK_DOWN_LINK) + follow_col = -1; + switch(cmd) { case 0: /* unmapped character */ default: @@ -1958,7 +2041,7 @@ new_cmd: /* 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_main_statusline(links[curdoc.link]); else if (more) HTInfoMsg(MOREHELP); @@ -2966,13 +3049,16 @@ new_cmd: /* !HText_LinksInLines(HTMainText, 1, Newline - 1))) { /* more links before this on screen, and first of them on a different line or no previous links before this screen? */ - int newlink = -1; - for (i = curdoc.link; i >= 0; i--) { - if (links[i].ly < links[curdoc.link].ly) { - newlink = i; - break; - } + int newlink; + + if (follow_col == -1) { + follow_col = links[curdoc.link].lx; + + if (links[curdoc.link].hightext) + follow_col += strlen(links[curdoc.link].hightext)/2; } + + newlink = find_link_near_col(follow_col, -1); if (newlink > -1) { highlight(OFF, curdoc.link, prev_target); curdoc.link = newlink; @@ -3021,13 +3107,16 @@ new_cmd: /* case LYK_DOWN_LINK: if (curdoc.link < (nlinks-1)) { /* more links? */ - int newlink = -1; - for (i = curdoc.link; i < nlinks; i++) - if (links[i].ly > links[curdoc.link].ly) { - newlink = i; - break; - } + int newlink; + if (follow_col == -1) { + follow_col = links[curdoc.link].lx; + + if (links[curdoc.link].hightext) + follow_col += strlen(links[curdoc.link].hightext)/2; + } + + newlink = find_link_near_col(follow_col, 1); if (newlink > -1) { highlight(OFF, curdoc.link, prev_target); curdoc.link = newlink; @@ -3118,7 +3207,7 @@ new_cmd: /* * Pop the file afterwards to prevent multiple copies. */ if (TRACE && !LYUseTraceLog && LYCursesON) { - move(LYlines-1, LYcols-1); /* make sure cursor is down */ + LYHideCursor(); /* make sure cursor is down */ #ifdef USE_SLANG addstr("\n"); #endif /* USE_SLANG */ @@ -3279,6 +3368,21 @@ new_cmd: /* case LYK_ACTIVATE: /* follow a link */ case LYK_SUBMIT: /* follow a link, submit TEXT_SUBMIT input */ +#ifndef NO_NONSTICKY_INPUTS + if (nlinks > 0 && + links[curdoc.link].type == WWW_FORM_LINK_TYPE && + (links[curdoc.link].form->type == F_TEXT_TYPE || + 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)) { + + textinput_activated = TRUE; + textinput_drawn = FALSE; + if (!sticky_inputs) + show_main_statusline(links[curdoc.link]); + break; + } +#endif if (do_change_link(prev_target) == -1) { LYforce_no_cache = FALSE; reloading = FALSE; @@ -3438,7 +3542,7 @@ new_cmd: /* links[curdoc.link].form->type == F_TEXTAREA_TYPE) { show_formlink_statusline(links[curdoc.link].form); } - + c = change_form_link(&links[curdoc.link], &newdoc, &refresh_screen, links[curdoc.link].form->name, @@ -4537,7 +4641,7 @@ if (!LYUseFormsOptions) { /* * Make sure cursor is down. */ - move(LYlines-1, LYcols-1); + LYHideCursor(); #ifdef USE_SLANG addstr("\n"); #endif /* USE_SLANG */ @@ -5156,7 +5260,7 @@ if (!LYUseFormsOptions) { } break; } - + n = HText_InsertFile (&links[curdoc.link]); /* @@ -6655,9 +6759,10 @@ PRIVATE void show_main_statusline ARGS1( * Let them know if it's an index -- very rare. */ if (is_www_index) { - move(LYlines-1, LYcols-8); + char *indx = gettext("-index-"); + move(LYlines-1, LYcols - strlen(indx) - 1); start_reverse(); - addstr("-index-"); + addstr(indx); stop_reverse(); } @@ -6666,23 +6771,14 @@ PRIVATE void show_main_statusline ARGS1( * Show the URL or, for some internal links, the fragment */ char *cp = NULL; + if (curlink.type == WWW_INTERN_LINK_TYPE && strncmp(curlink.lname, "LYNXIMGMAP:", 11)) { cp = strchr(curlink.lname, '#'); } if (!cp) cp = curlink.lname; - if (more) { - if (is_www_index) - _user_message("-more- -index- %s", cp); - else - _user_message("-more- %s", cp); - } else { - if (is_www_index) - _user_message("-index- %s", cp); - else - statusline(cp); - } + status_link(cp, more, is_www_index); } else if (is_www_index && more) { char buf[128]; @@ -6701,8 +6797,14 @@ PRIVATE void show_main_statusline ARGS1( } else { _statusline(HELP); } + +#ifndef NO_NOSTICKY_INPUTS + if (textinput_drawn) { + _statusline(gettext("Inactive text input, activate to edit (e.g., press ENTER)")); + } +#endif /* turn off cursor since now it's probably on statusline -HV */ - move((LYlines - 1), (LYcols - 1)); + LYHideCursor(); } /* @@ -6773,3 +6875,72 @@ PRIVATE void exit_immediately_with_error_message ARGS2( } /* else: return(-1) in mainloop */ } + + +PRIVATE void status_link ARGS3( + char *, curlink_name, + BOOLEAN, show_more, + BOOLEAN, show_indx) +{ +#define MAX_STATUS (LYcols - 2) +#define MIN_STATUS MAX_STATUS / 2 + char format[MAX_LINE]; + int prefix; + int length; + + *format = 0; + if (show_more) + sprintf(format, "%s ", gettext("-more-")); + if (show_indx) + sprintf(format + strlen(format), "%s ", gettext("-index-")); + prefix = strlen(format); + length = strlen(curlink_name); + + if (prefix > MAX_STATUS) { + _user_message("%s", format); /* no room for url */ + } else { + sprintf(format + prefix, "%%.%ds", MAX_STATUS - prefix); + + if ((length + prefix > MAX_STATUS) && long_url_ok) { + char *buf = NULL; + int j; + int k; + int cut_position; + int link_position; + + StrAllocCopy(buf, curlink_name); + + /* Scan to find the final leaf of the url, put it in 'k'. + * Ignore trailing '/'. + */ + for (j = length; (j > 0) && buf[j] != '/'; --j) + ; + if (j >= (length - 3)) { + for (k = j - 1; (k > 0) && buf[k] != '/'; --k) + ; + } else { + k = j; + } + + /* We assume that one can recognize the link from at least + * MIN_STATUS characters. + */ + cut_position = MAX_STATUS - prefix - (length - k); + if (cut_position < MIN_STATUS){ + cut_position = MIN_STATUS; + link_position = length - MIN_STATUS + 3; + } else { + link_position = k; + } + for (j = 0; j < 3; j++) + buf[cut_position++] = '_'; + if (cut_position < link_position) + while ((buf[cut_position++] = buf[link_position++]) != 0) + ; + _user_message(format, buf); + FREE(buf); + } else { /* show (possibly truncated) url */ + _user_message(format, curlink_name); + } + } +} diff --git a/src/LYNews.c b/src/LYNews.c index 538f1287..75bd26d2 100644 --- a/src/LYNews.c +++ b/src/LYNews.c @@ -121,7 +121,12 @@ PUBLIC char *LYNewsPost ARGS2( * Open a temporary file for the headers * and message body. - FM */ - if ((fd = LYOpenTemp(my_tempfile, HTML_SUFFIX, "w")) == NULL) { +#ifdef __DJGPP__ + if ((fd = LYOpenTemp(my_tempfile, HTML_SUFFIX, "wb")) == NULL) +#else + if ((fd = LYOpenTemp(my_tempfile, HTML_SUFFIX, "w")) == NULL) +#endif /* __DJGPP__ */ + { HTAlert(CANNOT_OPEN_TEMP); return(postfile); } diff --git a/src/LYOptions.c b/src/LYOptions.c index 3028c965..563dfd8c 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -3663,6 +3663,11 @@ PUBLIC int postoptions ARGS1( && keypad_mode != newval) { keypad_mode = newval; need_reload = TRUE; + if (keypad_mode == NUMBERS_AS_ARROWS) { + set_numbers_as_arrows(); + } else { + reset_numbers_as_arrows(); + } } } diff --git a/src/LYPrint.c b/src/LYPrint.c index 9a80ede4..4fa44c02 100644 --- a/src/LYPrint.c +++ b/src/LYPrint.c @@ -480,7 +480,7 @@ PRIVATE void send_file_to_mail ARGS3( char hdrfile[LY_MAXPATH]; char my_temp[LY_MAXPATH]; #endif -#if defined(DOSPATH) || defined(WIN_EX) +#if defined(DOSPATH) char my_temp[LY_MAXPATH]; #endif @@ -656,19 +656,19 @@ PRIVATE void send_file_to_mail ARGS3( } stop_curses(); -#ifdef SH_EX - SetOutputMode(O_TEXT); -#endif + SetOutputMode( O_TEXT ); printf(MAILING_FILE); LYSystem(buffer); sleep(AlertSecs); start_curses(); + SetOutputMode( O_BINARY ); + if (isPMDF) LYRemoveTemp(hdrfile); LYRemoveTemp(my_temp); #else /* !VMS (Unix or DOS) */ -#if defined(DOSPATH) || defined(WIN_EX) +#if defined(DOSPATH) outfile_fp = LYOpenTemp(my_temp, ".txt", "w"); #else HTSprintf0(&buffer, "%s %s", system_mail, system_mail_flags); @@ -779,19 +779,17 @@ PRIVATE void send_file_to_mail ARGS3( HTSprintf0(&buffer, "%s -t \"%s\" -F %s", system_mail, user_response, my_temp); LYCloseTempFP(outfile_fp); /* Close the tmpfile. */ + stop_curses(); -#ifdef SH_EX SetOutputMode(O_TEXT); -#endif printf("%s\n\n$ %s\n\n%s", gettext("Sending"), buffer, PLEASE_WAIT); LYSystem(buffer); sleep(MessageSecs); start_curses(); -#ifdef SH_EX SetOutputMode( O_BINARY ); -#endif + LYRemoveTemp(my_temp); /* Delete the tmpfile. */ -#else +#else /* !WIN_EX */ pclose(outfile_fp); #endif #endif /* VMS */ @@ -934,9 +932,7 @@ check_again: stop_curses(); CTRACE(tfp, "command: %s\n", the_command); -#ifdef SH_EX SetOutputMode( O_TEXT ); -#endif printf(PRINTING_FILE); /* * Set various bits of document information as environment variables, for @@ -967,10 +963,10 @@ check_again: signal(SIGINT, cleanup_sig); #endif /* !VMS */ #ifdef SH_EX - fprintf(stdout," Print job complite.\n"); + fprintf(stdout, gettext(" Print job complete.\n")); fflush(stdout); - SetOutputMode( O_BINARY ); #endif + SetOutputMode( O_BINARY ); sleep(MessageSecs); start_curses(); @@ -1000,9 +996,7 @@ PRIVATE void send_file_to_screen ARGS3( outfile_fp = stdout; stop_curses(); -#ifdef SH_EX SetOutputMode( O_TEXT ); -#endif #ifndef VMS signal(SIGINT, SIG_IGN); @@ -1047,8 +1041,8 @@ PRIVATE void send_file_to_screen ARGS3( } #ifdef SH_EX fprintf(stdout,"\n"); - SetOutputMode( O_BINARY ); #endif + SetOutputMode( O_BINARY ); start_curses(); done: /* send_file_to_screen() */ diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 68c5450c..3a765e6c 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -957,7 +957,7 @@ static int parse_html_src_spec ARGS3( return 0; } -#ifdef __STDC__ +#if defined(__STDC__) || defined(_WIN_CC) #define defHTSRC_parse_fun(x) static int html_src_set_##x ARGS1( char*,str) \ { parse_html_src_spec(HTL_##x,str,#x); return 0; } #else @@ -1224,6 +1224,9 @@ static Config_Type Config_Table [] = PARSE_SET("source_cache", CONF_FUN, source_cache_fun), #endif PARSE_STR("startfile", CONF_STR, &startfile), +#ifndef NO_NONSTICKY_INPUTS + PARSE_SET("sticky_inputs", CONF_BOOL, &sticky_inputs), +#endif PARSE_SET("strip_dotdot_urls", CONF_BOOL, &LYStripDotDotURLs), PARSE_SET("substitute_underscores", CONF_BOOL, &use_underscore), PARSE_FUN("suffix", CONF_FUN, suffix_fun), diff --git a/src/LYStrings.c b/src/LYStrings.c index a26e4c58..db33de8f 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -157,7 +157,7 @@ PUBLIC int fancy_mouse ARGS3( cmd = LYX_TOGGLE; #endif } else if (BUTTON_STATUS(1) & (BUTTON_ALT | BUTTON_SHIFT | BUTTON_CTRL)) { - /* Probably some unrelated activity, such as selecting some text. + /* Probably some unrelated activity, such as selecting some text. * Select, but do nothing else. */ *position += delta; @@ -271,7 +271,9 @@ PRIVATE int XYdist ARGS5( xerr = 0; if (yerr < 0) yerr = -yerr; - return xerr + yerr; + if (xerr < 3 && yerr) /* x-distance of 3 better than y-dist of 1 */ + return yerr + 1; + return (xerr + 2)/3 + yerr; /* Subjective factor of distance */ } /* Given X and Y coordinates of a mouse event, set mouse_link to the @@ -304,7 +306,7 @@ PRIVATE int set_clicked_link ARGS4( else if (x > right) c = '\b'; else c = PGUP; } else { - int mouse_err = 3, /* must be closer than this for approx stuff */ + int mouse_err = 4, /* subjctv-dist better than this for approx stuff */ cur_err; /* Loop over the links and see if we can get a match */ @@ -685,7 +687,7 @@ static SLKeyMap_List_Type *Keymap_List; # ifdef VMS # define EXTERN_KEY(string,string1,lynx,curses) {string,lynx} # else -# define EXTERN_KEY(string,string1,lynx,curses) {string1,lynx} +# define EXTERN_KEY(string,string1,lynx,curses) {string,lynx},{string1,lynx} # endif # define INTERN_KEY(string,lynx,curses) {string,lynx} #else @@ -915,7 +917,7 @@ PUBLIC int map_string_to_keysym ARGS2(char*, str, int*,keysym) #ifndef USE_SLANG if (*keysym > 255) *keysym |= LKC_ISLKC; /* caller should remove this flag - kw */ -#endif +#endif } } else { Keysym_String_List *k; @@ -975,19 +977,32 @@ PRIVATE int setkey_cmd (char *parse) int keysym; char buf[BUFSIZ]; + CTRACE(tfp, "KEYMAP(PA): in=%s", parse); /* \n-terminated */ if ((s = skip_keysym(parse)) != 0) { if (isspace(*s)) { *s++ = '\0'; s = LYSkipBlanks(s); - if ((t = skip_keysym(s)) == 0) + if ((t = skip_keysym(s)) == 0) { + CTRACE(tfp, "KEYMAP(SKIP) no key expansion found\n"); return -1; + } if (t != s) *t = '\0'; if (map_string_to_keysym (s, &keysym) >= 0 && unescape_string(parse, buf)) { + CTRACE(tfp, "KEYMAP(DEF) keysym=%#x, seq='%s'\n", keysym, buf); return define_key(buf, keysym); } + else { + CTRACE(tfp, "KEYMAP(SKIP) could not map to keysym\n"); + } } + else { + CTRACE(tfp, "KEYMAP(SKIP) junk after key description: '%s'\n", s); + } + } + else { + CTRACE(tfp, "KEYMAP(SKIP) no key description\n"); } return -1; } @@ -1587,6 +1602,9 @@ re_read: current_modifier = LKC_MOD2; c &= LKC_MASK; } + if (c >= 0 && (c&LKC_ISLAC)) { + done_esc = TRUE; /* already a lynxactioncode, skip keypad switches - iz */ + } #endif if (done_esc) { /* don't do keypad() switches below, we already got it - kw */ @@ -1789,11 +1807,15 @@ re_read: case KEY_MOUSE: if (code == FOR_CHOICE) { c = MOUSE_KEY; /* Will be processed by the caller */ - } else if (code == FOR_SINGLEKEY) { + } +#if !defined(_WINDOWS) /* 1999/07/15 (Thu) 08:40:18 */ + else if (code == FOR_SINGLEKEY) { MEVENT event; getmouse(&event); /* Completely ignore event - kw */ c = DO_NOTHING; - } else { + } +#endif + else { #if !defined(WIN_EX) MEVENT event; int err; @@ -1827,7 +1849,12 @@ re_read: lac = LYK_SUBMIT; } else if (event.bstate & BUTTON3_CLICKED) { c = LAC_TO_LKC0(LYK_PREV_DOC); - } else if (code == FOR_PROMPT) { + } else if (code == FOR_PROMPT + /* Cannot ignore: see LYCurses.c */ + || (event.bstate & + ( BUTTON1_PRESSED | BUTTON1_RELEASED + | BUTTON2_PRESSED | BUTTON2_RELEASED + | BUTTON3_PRESSED | BUTTON3_RELEASED))) { /* Completely ignore - don't return anything, to avoid canceling the prompt - kw */ goto re_read; @@ -1908,7 +1935,7 @@ re_read: c = PGUP; p = "PGUP"; } } else { - c = set_clicked_link(MOUSE_X_POS, MOUSE_Y_POS, FOR_PANEL); + c = set_clicked_link(MOUSE_X_POS, MOUSE_Y_POS, FOR_PANEL, 1); } } } else { @@ -1946,7 +1973,7 @@ re_read: c = PGUP; p = "PGUP"; } } else { - c = set_clicked_link(MOUSE_X_POS, MOUSE_Y_POS, FOR_PANEL); + c = set_clicked_link(MOUSE_X_POS, MOUSE_Y_POS, FOR_PANEL, 1); } } if (p && c != -1) { @@ -2067,6 +2094,8 @@ re_read: } #endif /* USE_SLANG && __DJGPP__ && !DJGPP_KEYHANDLER && !USE_KEYMAPS */ + if (c&LKC_ISLAC) + return(c); if ((c+1) >= KEYMAP_SIZE) { /* * Don't return raw values for KEYPAD symbols which we may have @@ -2090,8 +2119,9 @@ PUBLIC int LYgetch NOARGS * Convert a null-terminated string to lowercase */ PUBLIC void LYLowerCase ARGS1( - unsigned char *, buffer) + char *, arg_buffer) { + register unsigned char *buffer = (unsigned char *) arg_buffer; size_t i; for (i = 0; buffer[i]; i++) #ifdef SUPPORT_MULTIBYTE_EDIT /* 1998/11/23 (Mon) 17:04:55 */ @@ -2114,8 +2144,9 @@ PUBLIC void LYLowerCase ARGS1( * Convert a null-terminated string to uppercase */ PUBLIC void LYUpperCase ARGS1( -unsigned char *, buffer) + char *, arg_buffer) { + register unsigned char *buffer = (unsigned char *) arg_buffer; size_t i; for (i = 0; buffer[i]; i++) #ifdef SUPPORT_MULTIBYTE_EDIT /* 1998/11/23 (Mon) 17:05:10 */ @@ -2336,7 +2367,7 @@ PRIVATE int prev_pos ARGS2( while (i < pos - 1) { int c; c = Buf[i]; - + if (!(isascii(c) || IS_KANA(c))) { i++; } @@ -2428,7 +2459,7 @@ PUBLIC int LYEdit1 ARGS4( ch &= 0xFF; if (ch + 64 >= LYlowest_eightbit[current_char_set]) ch += 64; - + if (Pos <= (MaxLen) && StrLen < (MaxLen)) { #ifdef ENHANCED_LINEEDIT if (Mark > Pos) @@ -2990,7 +3021,7 @@ again: LYRefreshEdit(&MyEdit); #endif /* SUPPORT_MULTIBYTE_EDIT */ ch = LYgetch_for(FOR_PROMPT); -#ifdef SUPPORT_MULTIBYTE_EDIT +#ifdef SUPPORT_MULTIBYTE_EDIT #ifdef CJK_EX /* for SJIS code */ if (!refresh && (EditBinding(ch) != LYE_CHAR)) diff --git a/src/LYStrings.h b/src/LYStrings.h index c61ab0c7..e6bf1ac0 100644 --- a/src/LYStrings.h +++ b/src/LYStrings.h @@ -247,9 +247,9 @@ extern int map_string_to_keysym PARAMS((char * src, int *lec)); #endif extern void LYLowerCase PARAMS(( - unsigned char * buffer)); + char * buffer)); extern void LYUpperCase PARAMS(( - unsigned char * buffer)); + char * buffer)); extern void LYRemoveBlanks PARAMS(( char * buffer)); extern char * LYSkipBlanks PARAMS(( diff --git a/src/LYStyle.c b/src/LYStyle.c index 062c2715..75bfeccb 100644 --- a/src/LYStyle.c +++ b/src/LYStyle.c @@ -1,6 +1,6 @@ /* character level styles for Lynx * (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-) - * $Id: LYStyle.c,v 1.22 1999/07/14 16:44:55 tom Exp $ + * $Id: LYStyle.c,v 1.23 1999/07/30 16:06:54 tom Exp $ */ #include <HTUtils.h> #include <HTML.h> @@ -67,8 +67,9 @@ PUBLIC int s_alink = NOSTYLE, s_a = NOSTYLE, s_status = NOSTYLE, s_whereis= NOSTYLE; /* start somewhere safe */ +#define MAX_COLOR 8 PRIVATE int colorPairs = 0; -PRIVATE int last_fA = COLOR_WHITE, last_bA = COLOR_BLACK; +PRIVATE unsigned char our_pairs[2][MAX_COLOR][MAX_COLOR]; /* icky parsing of the style options */ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char*,element) @@ -118,6 +119,13 @@ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char* fA = check_color(fg, default_fg); bA = check_color(bg, default_bg); + + if (style == -1) { /* default */ + CTRACE(tfp, "CSS(DEF):default_fg=%d, default_bg=%d\n", fA, bA); + default_fg = fA; + default_bg = bA; + return; + } if (fA == NO_COLOR) { bA = NO_COLOR; } else if (COLORS) { @@ -139,19 +147,31 @@ PRIVATE void parse_attributes ARGS5(char*,mono,char*,fg,char*,bg,int,style,char* */ if (lynx_has_color && colorPairs < COLOR_PAIRS-1 && fA != NO_COLOR) { - if (colorPairs <= 0 || fA != last_fA || bA != last_bA) { - colorPairs++; - init_pair(colorPairs, fA, bA); - last_fA = fA; - last_bA = bA; + int curPair; + + if (fA < MAX_COLOR + && bA < MAX_COLOR + && our_pairs[cA == A_BOLD][fA][bA]) + curPair = our_pairs[cA == A_BOLD][fA][bA] - 1; + else { + curPair = ++colorPairs; + init_pair(curPair, fA, bA); + if (fA < MAX_COLOR + && bA < MAX_COLOR + && curPair < 255) + our_pairs[cA == A_BOLD][fA][bA] = curPair + 1; } + CTRACE(tfp, "CSS(CURPAIR):%d\n", colorPairs); if (style < DSTYLE_ELEMENTS) - setStyle(style, COLOR_PAIR(colorPairs)|cA, cA, mA); - setHashStyle(newstyle, COLOR_PAIR(colorPairs)|cA, cA, mA, element); + setStyle(style, COLOR_PAIR(curPair)|cA, cA, mA); + setHashStyle(newstyle, COLOR_PAIR(curPair)|cA, cA, mA, element); } else { - /* only mono is set */ + if (lynx_has_color && fA != NO_COLOR) { + CTRACE(tfp, "CSS(NC): maximum of %d colorpairs exhausted\n", COLOR_PAIRS - 1); + } + /* only mono is set */ if (style < DSTYLE_ELEMENTS) setStyle(style, -1, -1, mA); setHashStyle(newstyle, -1, -1, mA, element); @@ -218,7 +238,11 @@ where OBJECT is one of EM,STRONG,B,I,U,BLINK etc.\n\n"), buffer); /* * We use some pseudo-elements, so catch these first */ - if (!strncasecomp(element, "alink", 5)) /* active link */ + if (!strncasecomp(element, "default", 7)) /* default fg/bg */ + { + parse_attributes(mono,fg,bg,-1,"default"); + } + else if (!strncasecomp(element, "alink", 5)) /* active link */ { parse_attributes(mono,fg,bg,DSTYLE_ALINK,"alink"); } @@ -396,7 +420,7 @@ PUBLIC void style_defaultStyleSheet NOARGS HStyle_addStyle(default_stylesheet[i]); } -PUBLIC int style_readFromFile ARGS1(char*, file) +PRIVATE int style_readFromFileREC ARGS2(char*, file, int, toplevel) { FILE *fh; char *buffer = NULL; @@ -413,15 +437,19 @@ PUBLIC int style_readFromFile ARGS1(char*, file) return -1; } - style_initialiseHashTable(); - style_deleteStyleList(); + if (toplevel) { + style_initialiseHashTable(); + style_deleteStyleList(); + } while (LYSafeGets(&buffer, fh) != NULL) { LYTrimTrailing(buffer); LYTrimTail(buffer); LYTrimHead(buffer); - if (buffer[0] != '#' && (len = strlen(buffer)) > 0) + if (!strncasecomp(buffer,"include:",8)) + style_readFromFileREC(buffer+8, 0); + else if (buffer[0] != '#' && (len = strlen(buffer)) > 0) HStyle_addStyle(buffer); } /* the default styles are added after the user styles in order @@ -430,11 +458,16 @@ PUBLIC int style_readFromFile ARGS1(char*, file) /* style_defaultStyleSheet(); */ fclose (fh); - if (LYCursesON) + if (toplevel && LYCursesON) parse_userstyles(); return 0; } +PUBLIC int style_readFromFile ARGS1(char*, file) +{ + return style_readFromFileREC(file, 1); +} + /* Used in HTStructured methods: - kw */ PUBLIC void TrimColorClass ARGS3( diff --git a/src/LYUtils.c b/src/LYUtils.c index 84b4037f..9e5b4548 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -145,6 +145,10 @@ PUBLIC void highlight ARGS3( */ if (cur < 0) cur = 0; +#ifndef NO_NONSTICKY_INPUTS + if (flag == OFF) + textinput_drawn = FALSE; +#endif if (nlinks > 0) { #if defined(USE_COLOR_STYLE) && !defined(NO_HILIT_FIX) @@ -1748,7 +1752,7 @@ highlight_search_done: /* * Get cursor out of the way. */ - move((LYlines - 1), (LYcols - 1)); + LYHideCursor(); else #endif /* FANCY CURSES || USE_SLANG */ /* @@ -1914,7 +1918,7 @@ PUBLIC void statusline ARGS1( else TO_SJIS((CONST unsigned char *)text_buff, temp); #else - strcpy(temp, text_buff); + strcpy((char *) temp, text_buff); #endif } else { for (i = 0, j = 0; text_buff[i]; i++) { @@ -3146,6 +3150,53 @@ PUBLIC void LYExtSignal ARGS2( } #endif /* HAVE_SIGACTION */ +#if defined(SIGTSTP) && !defined(USE_SLANG) +#if HAVE_SIGACTION +/* + * For switching a signal's handling between SIG_DFL and something + * (possibly) different that may have been set up by lynx code or + * e.g. by curses library. Uses sigaction to preserve / restore as + * much state as possible. + * Second arg is where to save or restore from. + * Third arg to_dfl specifies what to do: + * 1 Save current state in where, set handling to SIG_DFL + * 0 Restore current state to previously saved one in where + * + * Currently only used for SIGTSTP without SLANG, to prevent (n)curses + * signal handler from running while lynx is waiting in system() for + * an interactive command like an editor. - kw + */ +PRIVATE BOOLEAN LYToggleSigDfl ARGS3( + int, sig, + struct sigaction *, where, + int, to_dfl) +{ + int rv = -1; + struct sigaction oact; + + if (to_dfl == 1) { + rv = sigaction(sig, NULL, &oact); + if (rv == 0) { + if (oact.sa_handler != SIG_DFL) { + oact.sa_handler = SIG_DFL; + rv = sigaction(sig, &oact, where); + } else if (where) { + memcpy(where, &oact, sizeof(oact)); + rv = 0; + } + } + } else { + rv = sigaction(sig, where, NULL); + } + if (rv != 0) { + CTRACE(tfp, "Error in LYToggleSigDfl: %s\n", LYStrerror(errno)); + return FALSE; + } else + return TRUE; +} +#endif /* HAVE_SIGACTION */ +#endif /* SIGTSTP && !USE_SLANG */ + /************** ** This bit of code catches window size change signals **/ @@ -5298,7 +5349,11 @@ PUBLIC CONST char * Home_Dir NOARGS if (homedir == NULL) { if ((cp = getenv("HOME")) == NULL || *cp == '\0' #ifdef UNIX - || *cp != '/' + || !(LYIsPathSep(*cp) +# ifdef __EMX__ + || (*cp && cp[1] == ':' && LYIsPathSep(cp[2])) +# endif + ) #endif /* UNIX */ ) { #if defined (DOSPATH) || defined (__EMX__) /* BAD! WSB */ @@ -7048,6 +7103,11 @@ PUBLIC int LYSystem ARGS1( { int code; int do_free = 0; +#if HAVE_SIGACTION && defined(SIGTSTP) && !defined(USE_SLANG) + struct sigaction saved_sigtstp_act; + BOOLEAN sigtstp_saved = FALSE; +#endif + int saved_errno = 0; fflush(stdout); fflush(stderr); @@ -7141,7 +7201,16 @@ PUBLIC int LYSystem ARGS1( #else if (restore_sigpipe_for_children) signal(SIGPIPE, SIG_DFL); /* Some commands expect the default */ +#if HAVE_SIGACTION && defined(SIGTSTP) && !defined(USE_SLANG) + if (!dump_output_immediately && !LYCursesON && !no_suspend) + sigtstp_saved = LYToggleSigDfl(SIGTSTP, &saved_sigtstp_act, 1); +#endif code = system(command); + saved_errno = errno; +#if HAVE_SIGACTION && defined(SIGTSTP) && !defined(USE_SLANG) + if (sigtstp_saved) + LYToggleSigDfl(SIGTSTP, &saved_sigtstp_act, 0); +#endif if (restore_sigpipe_for_children) signal(SIGPIPE, SIG_IGN); /* Ignore it again - kw */ #endif @@ -7157,6 +7226,9 @@ PUBLIC int LYSystem ARGS1( if (do_free) FREE(command); +#if !defined(UCX) || !defined(VAXC) /* errno not modifiable ?? */ + errno = saved_errno; /* may have been clobbered */ +#endif return code; } diff --git a/src/LYUtils.h b/src/LYUtils.h index 9d962a7c..6c07b971 100644 --- a/src/LYUtils.h +++ b/src/LYUtils.h @@ -33,7 +33,7 @@ #define LYIsPipeCommand(s) ((s)[0] == '|') -#ifdef DOSPATH +#if defined(DOSPATH) || defined(__EMX__) #define LYIsPathSep(ch) ((ch) == '/' || (ch) == '\\') #else #define LYIsPathSep(ch) ((ch) == '/') diff --git a/src/Xsystem.c b/src/Xsystem.c index e82cc5a4..7a759c92 100644 --- a/src/Xsystem.c +++ b/src/Xsystem.c @@ -1,9 +1,12 @@ -/* $Id: Xsystem.c,v 1.1 1999/07/14 16:44:55 tom Exp $ +/* $Id: Xsystem.c,v 1.2 1999/07/30 16:06:54 tom Exp $ * like system("cmd") but return with exit code of "cmd" * for Turbo-C/MS-C/LSI-C * This code is in the public domain. * * $Log: Xsystem.c,v $ + * Revision 1.2 1999/07/30 16:06:54 tom + * 2.8.3dev.3 + * * Revision 1.1 1999/07/14 16:44:55 tom * Initial revision * @@ -344,7 +347,7 @@ prog_go(PRO * p, int flag) ep = getenv("PATH"); strcpy(cmdb, p->cmd); for (;;) { - if (extp) { /* has extention */ + if (extp) { /* has extension */ if ((rc = open(cmdb, O_RDONLY)) >= 0) { close(rc); rc = spawnl(flag, cmdb, cmdb, p->arg, (char *) 0); @@ -372,7 +375,7 @@ prog_go(PRO * p, int flag) } } } else { /* has PATH or Drive */ - if (extp) { /* has extention */ + if (extp) { /* has extension */ if ((rc = open(p->cmd, O_RDONLY)) >= 0) { close(rc); return spawnl(flag, p->cmd, p->cmd, p->arg, (char *) 0); diff --git a/src/chrtrans/makefile.bcb b/src/chrtrans/makefile.bcb new file mode 100644 index 00000000..95eb33f7 --- /dev/null +++ b/src/chrtrans/makefile.bcb @@ -0,0 +1,114 @@ +# +# Borland C++ IDE generated makefile +# +# 1997/11/09 (Sun) 14:29:50 +# +.AUTODEPEND + + +# +# Borland C++ tools +# +IMPLIB = Implib +BCC32 = Bcc32 +BccW32.cfg +TLINK32 = TLink32 +TLIB = TLib +BRC32 = Brc32 +TASM32 = Tasm32 +# +# macros +# +BCB = $(MAKEDIR)/.. +BCC_INC = $(BCB)/INCLUDE + +# +# Options +# + +INCLUDES = -I.;../..;../../WWW/LIBRARY/IMPLEMENTATION;$(BCC_INC) +DEFS =-DNO_FILIO_H;NO_UNISTD_H;_WINDOWS;DOSPATH +LNIEAT_dbmakeuctbdexe = -x + +# +# Dependency List +# +Dep_char = .\makeuctb.exe + +char : BccW32.cfg $(Dep_char) + echo MakeNode + +Dep_dbmakeuctbdexe = .\makeuctb.obj + +.\makeuctb.exe : $(Dep_dbmakeuctbdexe) + $(BCC32) makeuctb.obj + +### +.\makeuctb.obj : makeuctb.c + $(BCC32) -P- -c $(DEFS) $(INCLUDES) -o$@ makeuctb.c + +# Compiler configuration file +BccW32.cfg : + Copy &&| +-R +-v +-vi +-H +-H=lynx.csm +-w- +-A- +-wcpt +-wrpt +-wrng +-w-voi +-w-ret +-w-sus +-w-dup +-w-big +-w-ext +-w-zdi +-w-bei +-w-obi +-w-ofp +-w-eas +-w-hid +-w-ncf +-w-ibc +-w-dsz +-w-nst +-w-mpc +-w-mpd +-w-ntd +-w-nvf +-w-hch +-w-inl +-w-lin +-w-lvc +-w-pia +-w-def +-w-nod +-w-pro +-w-rvl +-w-ccc +-w-aus +-w-par +-w-rch +-w-eff +-w-ill +-w-ias +-w-msg +-WC +-Ot +-d- +-K +-a- +-w-stu +-wbbf +-w-dpu +-wcln +-wsig +-wucp +-g200 +-H- +-v- +| $@ + diff --git a/src/chrtrans/makefile.w32 b/src/chrtrans/makefile.w32 deleted file mode 100644 index 4968995f..00000000 --- a/src/chrtrans/makefile.w32 +++ /dev/null @@ -1,129 +0,0 @@ -# -# Borland C++ IDE generated makefile -# -.AUTODEPEND - - -# -# Borland C++ tools -# -IMPLIB = Implib -BCC32 = Bcc32 +BccW32.cfg -TLINK32 = TLink32 -TLIB = TLib -BRC32 = Brc32 -TASM32 = Tasm32 -# -# IDE macros -# - - -# -# Options -# -IDE_LFLAGS32 = -LD:\BC45\LIB -LLATC32_dbmakeuctbdexe = -LCURSES;D:\BC45\LIB -Tpe -ap -c -wdpl -wdup -RLATC32_dbmakeuctbdexe = -w32 -k -BLATC32_dbmakeuctbdexe = -CNIEAT_dbmakeuctbdexe = -I.\;..\..\CURSES;..;..\..\WWW\LIBRARY\IMPLEMENTATION;D:\BC45\INCLUDE -DNO_UNISTD_H;_WINDOWS;NCURSES;FANCY_CURSES;XMOSAIC_HACK;ACCESS_AUTH;NO_UTMP;NO_CUSERID;NO_TTYTYPE;NOSIGHUP;DOSPATH;NOUSERS -LNIEAT_dbmakeuctbdexe = -x -LEAT_dbmakeuctbdexe = $(LLATC32_dbmakeuctbdexe) -REAT_dbmakeuctbdexe = $(RLATC32_dbmakeuctbdexe) -BEAT_dbmakeuctbdexe = $(BLATC32_dbmakeuctbdexe) - -# -# Dependency List -# -Dep_char = \ - .\makeuctb.exe - -char : BccW32.cfg $(Dep_char) - echo MakeNode - -Dep_dbmakeuctbdexe = \ - .\makeuctb.obj - -.\makeuctb.exe : $(Dep_dbmakeuctbdexe) - $(TLINK32) @&&| - /v $(IDE_LFLAGS32) $(LEAT_dbmakeuctbdexe) $(LNIEAT_dbmakeuctbdexe) + -D:\BC45\LIB\c0x32.obj+ -.\makeuctb.obj -$<,$* -D:\BC45\LIB\bidsf.lib+ -D:\BC45\LIB\import32.lib+ -D:\BC45\LIB\cw32.lib - -| - -.\makeuctb.obj : makeuctb.c - $(BCC32) -P- -c @&&| - $(CEAT_dbmakeuctbdexe) $(CNIEAT_dbmakeuctbdexe) -o$@ makeuctb.c -| - -# Compiler configuration file -BccW32.cfg : - Copy &&| --R --v --vi --H --H=lynx.csm --w- --A- --wcpt --wrpt --wrng --w-voi --w-ret --w-sus --w-dup --w-big --w-ext --w-zdi --w-bei --w-obi --w-ofp --w-eas --w-hid --w-ncf --w-ibc --w-dsz --w-nst --w-mpc --w-mpd --w-ntd --w-nvf --w-hch --w-inl --w-lin --w-lvc --w-pia --w-def --w-nod --w-pro --w-rvl --w-ccc --w-aus --w-par --w-rch --w-eff --w-ill --w-ias --w-msg --WC --Ot --d- --K --a- --w-stu --wbbf --w-dpu --wcln --wsig --wucp --g200 --H- --v- -| $@ - - diff --git a/src/chrtrans/makew32.bat b/src/chrtrans/makew32.bat index 47b8ae69..e0e28bc4 100644 --- a/src/chrtrans/makew32.bat +++ b/src/chrtrans/makew32.bat @@ -1,7 +1,7 @@ @echo If .tbl files are added or removed you will need to hand edit @echo this batch file. -@echo . -make -f makefile.w32 +@echo off +make -l -f makefile.bcb makeuctb cp1250_uni.tbl > cp1250_uni.h makeuctb cp1251_uni.tbl > cp1251_uni.h makeuctb cp1252_uni.tbl > cp1252_uni.h @@ -21,7 +21,7 @@ makeuctb cp866u_uni.tbl > cp866u_uni.h makeuctb cp869_uni.tbl > cp869_uni.h makeuctb def7_uni.tbl > def7_uni.h makeuctb dmcs_uni.tbl > dmcs_uni.h -makeuctb hp_uni.tbl > hp_uni.h +makeuctb hp_uni.tbl > hp_uni.h makeuctb iso01_uni.tbl > iso01_uni.h makeuctb iso02_uni.tbl > iso02_uni.h makeuctb iso03_uni.tbl > iso03_uni.h @@ -32,7 +32,7 @@ makeuctb iso07_uni.tbl > iso07_uni.h makeuctb iso08_uni.tbl > iso08_uni.h makeuctb iso09_uni.tbl > iso09_uni.h makeuctb iso10_uni.tbl > iso10_uni.h -makeuctb iso15_uni.tbl > iso15_uni.h +makeuctb iso15_uni.tbl > iso15_uni.h makeuctb koi8r_uni.tbl > koi8r_uni.h makeuctb koi8u_uni.tbl > koi8u_uni.h makeuctb mac_uni.tbl > mac_uni.h |