diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-06-11 13:00:20 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-06-11 13:00:20 -0400 |
commit | 159955668b23e32fb7cefa1638bb40b8b3a58fa9 (patch) | |
tree | 232b28da1a8d72ec8f23944c79d5c438a0204f92 /src | |
parent | b5ffa7c020e319cbfceee3c506f5c16764800dc2 (diff) | |
download | lynx-snapshots-159955668b23e32fb7cefa1638bb40b8b3a58fa9.tar.gz |
snapshot of project "lynx", label v2-8-1dev_16
Diffstat (limited to 'src')
-rw-r--r-- | src/GridText.c | 138 | ||||
-rw-r--r-- | src/LYBookmark.c | 4 | ||||
-rw-r--r-- | src/LYDownload.c | 2 | ||||
-rw-r--r-- | src/LYMain.c | 12 | ||||
-rw-r--r-- | src/LYMainLoop.c | 17 | ||||
-rw-r--r-- | src/LYUtils.c | 8 |
6 files changed, 94 insertions, 87 deletions
diff --git a/src/GridText.c b/src/GridText.c index 1dc2d7b8..3e325d08 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -181,7 +181,7 @@ struct _HText { int top_of_screen; /* Line number */ HTLine * top_of_screen_line; /* Top */ HTLine * next_line; /* Bottom + 1 */ - int permissible_split; /* in last line */ + unsigned permissible_split; /* in last line */ BOOL in_line_1; /* of paragraph */ BOOL stale; /* Must refresh */ BOOL page_has_target; /* has target on screen */ @@ -1526,7 +1526,7 @@ PRIVATE void display_page ARGS3( addstr("\n Document is empty"); } - if (HTCJK != NOCJK || text->T.output_utf8 || TRACE) { + if (HTCJK != NOCJK || text->T.output_utf8) { /* * For non-multibyte curses. */ @@ -1572,7 +1572,7 @@ PUBLIC void HText_beginAppend ARGS1( PRIVATE void split_line ARGS2( HText *, text, - int, split) + unsigned, split) { HTStyle * style = text->style; HTLine * temp; @@ -1735,8 +1735,8 @@ PRIVATE void split_line ARGS2( */ if (split > 0) { /* Delete space at "split" splitting line */ char *p, *prevdata = previous->data, *linedata = line->data; - unsigned int plen; - int i; + unsigned plen; + unsigned i; /* * Split the line. - FM @@ -1763,13 +1763,15 @@ PRIVATE void split_line ARGS2( * Make sure our global flag is correct. - FM */ underline_on = NO; - for (i = (split-1); i >= 0; i--) { - if (prevdata[i] == LY_UNDERLINE_END_CHAR) { - break; - } - if (prevdata[i] == LY_UNDERLINE_START_CHAR) { - underline_on = YES; - break; + if (split) { + for (i = (split-1); i != 0; i--) { + if (prevdata[i] == LY_UNDERLINE_END_CHAR) { + break; + } + if (prevdata[i] == LY_UNDERLINE_START_CHAR) { + underline_on = YES; + break; + } } } /* @@ -1781,20 +1783,22 @@ PRIVATE void split_line ARGS2( ctrl_chars_on_this_line++; SpecialAttrChars++; } - for (i = (plen - 1); i >= 0; i--) { - if (p[i] == LY_UNDERLINE_START_CHAR) { - underline_on = YES; - break; - } - if (p[i] == LY_UNDERLINE_END_CHAR) { - underline_on = NO; - break; + if (plen) { + for (i = (plen - 1); i != 0; i--) { + if (p[i] == LY_UNDERLINE_START_CHAR) { + underline_on = YES; + break; + } + if (p[i] == LY_UNDERLINE_END_CHAR) { + underline_on = NO; + break; + } } - } - for (i = (plen - 1); i >= 0; i--) { - if (p[i] == LY_UNDERLINE_START_CHAR || - p[i] == LY_UNDERLINE_END_CHAR) { - ctrl_chars_on_this_line++; + for (i = (plen - 1); i != 0; i--) { + if (p[i] == LY_UNDERLINE_START_CHAR || + p[i] == LY_UNDERLINE_END_CHAR) { + ctrl_chars_on_this_line++; + } } } } @@ -1804,13 +1808,15 @@ PRIVATE void split_line ARGS2( * sure that our global flag is correct. - FM */ bold_on = NO; - for (i = (split - 1); i >= 0; i--) { - if (prevdata[i] == LY_BOLD_END_CHAR) { - break; - } - if (prevdata[i] == LY_BOLD_START_CHAR) { - bold_on = YES; - break; + if (split) { + for (i = (split - 1); i != 0; i--) { + if (prevdata[i] == LY_BOLD_END_CHAR) { + break; + } + if (prevdata[i] == LY_BOLD_START_CHAR) { + bold_on = YES; + break; + } } } /* @@ -1822,25 +1828,27 @@ PRIVATE void split_line ARGS2( ctrl_chars_on_this_line++; SpecialAttrChars++;; } - for (i = (plen - 1); i >= 0; i--) { - if (p[i] == LY_BOLD_START_CHAR) { - bold_on = YES; - break; - } - if (p[i] == LY_BOLD_END_CHAR) { - bold_on = NO; - break; - } - } - for (i = (plen - 1); i >= 0; i--) { - if (p[i] == LY_BOLD_START_CHAR || - p[i] == LY_BOLD_END_CHAR || - IS_UTF_EXTRA(p[i]) || - p[i] == LY_SOFT_HYPHEN) { - ctrl_chars_on_this_line++; + if (plen) { + for (i = (plen - 1); i != 0; i--) { + if (p[i] == LY_BOLD_START_CHAR) { + bold_on = YES; + break; + } + if (p[i] == LY_BOLD_END_CHAR) { + bold_on = NO; + break; + } } - if (p[i] == LY_SOFT_HYPHEN && text->permissible_split < i) { - text->permissible_split = i + 1; + for (i = (plen - 1); i != 0; i--) { + if (p[i] == LY_BOLD_START_CHAR || + p[i] == LY_BOLD_END_CHAR || + IS_UTF_EXTRA(p[i]) || + p[i] == LY_SOFT_HYPHEN) { + ctrl_chars_on_this_line++; + } + if (p[i] == LY_SOFT_HYPHEN && text->permissible_split < i) { + text->permissible_split = i + 1; + } } } @@ -1923,12 +1931,12 @@ PRIVATE void split_line ARGS2( if (split > 0) { for (a = text->first_anchor; a; a = a->next) { if (a->line_num == CurLine) { - if (a->line_pos >= split) { + if ((unsigned)a->line_pos >= split) { a->start += (1 + SpecialAttrChars - HeadTrim - TailTrim); a->line_pos -= (split - SpecialAttrChars + HeadTrim); a->line_num = text->Lines; } else if ((a->link_type & HYPERTEXT_ANCHOR) && - (a->line_pos + a->extent) >= split) { + (unsigned)(a->line_pos + a->extent) >= split) { a->extent -= (TailTrim + HeadTrim); if (a->extent < 0) { a->extent = 0; @@ -2144,7 +2152,7 @@ PUBLIC void HText_appendCharacter ARGS2( /* * Can split here. - FM */ - text->permissible_split = (int)text->last_line->size; + text->permissible_split = text->last_line->size; text->state = S_text; return; } else if (ch == 'I') { @@ -2152,7 +2160,7 @@ PUBLIC void HText_appendCharacter ARGS2( /* * Can split here. - FM */ - text->permissible_split = (int)text->last_line->size; + text->permissible_split = text->last_line->size; return; } else { text->state = S_text; @@ -2207,7 +2215,7 @@ PUBLIC void HText_appendCharacter ARGS2( /* * Can split here. - FM */ - text->permissible_split = (int)text->last_line->size; + text->permissible_split = text->last_line->size; return; } } @@ -2254,7 +2262,7 @@ PUBLIC void HText_appendCharacter ARGS2( * on the line, or if it is preceded by a space or * hyphen. - FM */ - if (line->size < 1 || text->permissible_split >= (int)line->size) + if (line->size < 1 || text->permissible_split >= line->size) return; for (i = (text->permissible_split + 1); line->data[i]; i++) { @@ -2374,7 +2382,7 @@ PUBLIC void HText_appendCharacter ARGS2( /* * Can split here. - FM */ - text->permissible_split = (int)line->size; + text->permissible_split = line->size; if (line->size == 0) { line->offset = line->offset + target - here; } else { @@ -2394,7 +2402,7 @@ PUBLIC void HText_appendCharacter ARGS2( /* * Can split here. - FM */ - text->permissible_split = (int)text->last_line->size; + text->permissible_split = text->last_line->size; /* * There are some pages written in * different kanji codes. - TA @@ -2515,7 +2523,7 @@ check_IgnoreExcess: /* * Can split here. - FM */ - text->permissible_split = (int)text->last_line->size; + text->permissible_split = text->last_line->size; } } } @@ -3174,10 +3182,8 @@ PUBLIC void HText_endAppend ARGS1( FREE(text->last_line); text->last_line = next_to_the_last_line; text->Lines--; -#ifdef NOTUSED_BAD_FOR_SCREEN CTRACE(tfp, "GridText: New bottom line: %s\n", text->last_line->data); -#endif } /* @@ -3225,15 +3231,13 @@ re_parse: if (anchor_ptr->extent < 0) { anchor_ptr->extent = 0; } -#ifdef NOTUSED_BAD_FOR_SCREEN CTRACE(tfp, "anchor text: '%s' pos: %d\n", line_ptr->data, anchor_ptr->line_pos); -#endif /* * If the link begins with an end of line and we have more * lines, then start the highlighting on the next line. - FM */ - if (anchor_ptr->line_pos >= strlen(line_ptr->data) && + if ((unsigned)anchor_ptr->line_pos >= strlen(line_ptr->data) && cur_line < text->Lines) { anchor_ptr->start += (cur_shift + 1); cur_shift = 0; @@ -3241,10 +3245,8 @@ re_parse: goto re_parse; } cur_shift = 0; -#ifdef NOTUSED_BAD_FOR_SCREEN CTRACE(tfp, "anchor text: '%s' pos: %d\n", line_ptr->data, anchor_ptr->line_pos); -#endif /* * Copy the link name into the data structure. */ @@ -3261,7 +3263,7 @@ re_parse: * If true the anchor extends over two lines, * copy that into the data structure. */ - if (anchor_ptr->extent > strlen(anchor_ptr->hightext)) { + if ((unsigned)anchor_ptr->extent > strlen(anchor_ptr->hightext)) { HTLine *line_ptr2 = line_ptr->next; /* * Double check that we have a line pointer, @@ -8059,7 +8061,7 @@ PUBLIC void HText_setBreakPoint ARGS1( /* * Can split here. - FM */ - text->permissible_split = (int)text->last_line->size; + text->permissible_split = text->last_line->size; return; } diff --git a/src/LYBookmark.c b/src/LYBookmark.c index 8b7827bc..5d1774d2 100644 --- a/src/LYBookmark.c +++ b/src/LYBookmark.c @@ -410,6 +410,7 @@ PUBLIC void remove_bookmark_link ARGS2( struct stat stat_buf; mode_t mode; #endif /* VMS */ + char homepath[256]; CTRACE(tfp, "remove_bookmark_link: deleting link number: %d\n", cur); @@ -426,7 +427,8 @@ PUBLIC void remove_bookmark_link ARGS2( return; } - if ((nfp = LYOpenScratch(newfile, filename_buffer)) == 0) { + LYAddPathToHome(homepath, sizeof(homepath), ""); + if ((nfp = LYOpenScratch(newfile, homepath)) == 0) { fclose(fp); _statusline(BOOKSCRA_OPEN_FAILED_FOR_DEL); sleep(AlertSecs); diff --git a/src/LYDownload.c b/src/LYDownload.c index f4e57a30..edc79d0c 100644 --- a/src/LYDownload.c +++ b/src/LYDownload.c @@ -599,7 +599,7 @@ cancelled: /* * LYdownload_options writes out the current download choices to - * a file so that the user can select printers in the same way that + * a file so that the user can select downloaders in the same way that * they select all other links. Download links look like: * LYNXDOWNLOAD://Method=<#>/File=<STRING>/SugFile=<STRING> */ diff --git a/src/LYMain.c b/src/LYMain.c index d836e568..06526a5d 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -722,7 +722,7 @@ PUBLIC int main ARGS2( exit(-1); } #else - StrAllocCopy(lynx_temp_space, TEMP_SPACE); + StrAllocCopy(lynx_temp_space, TEMP_SPACE); #endif if ((cp = strchr(lynx_temp_space, '~'))) { *(cp++) = '\0'; @@ -1186,10 +1186,10 @@ PUBLIC int main ARGS2( } fclose(fp); -#if defined(USE_SLANG_KEYMAPS) - if (-1 == lynx_initialize_keymaps ()) - exit (-1); -#endif +#if defined(USE_SLANG_KEYMAPS) + if (-1 == lynx_initialize_keymaps ()) + exit (-1); +#endif /* * Make sure we have the character sets declared. * This will initialize the CHARTRANS handling. - KW @@ -2808,10 +2808,12 @@ keys (may be incompatible with some curses packages)" "number_links", SET_ARG, &number_links, "force numbering of links" ), +#ifdef DISP_PARTIAL PARSE_SET( "partial", TOGGLE_ARG, &display_partial, "display partial pages while downloading" ), +#endif PARSE_FUN( "pauth", NEED_FUNCTION_ARG, pauth_fun, "=id:pw\nauthentication information for protected proxy server" diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index 2c621748..566027f3 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -501,20 +501,16 @@ try_again: #ifdef DISP_PARTIAL display_partial = display_partial_flag; /* reset */ - Newline_partial = 0; /* initialize */ - NumOfLines_partial = 0; /* initialize */ + Newline_partial = newdoc.line; /* initialize */ + NumOfLines_partial = 0; /* initialize */ /* * Disable display_partial if requested URL has #fragment. * Otherwise user got the new document from the first page and * be moved to #fragment later after download completed, but - * only if user did not mess screen up by scrolling before... + * only if user did not mess screen up by scrolling before... * So fall down to old behavior here. - * Also we should avoid displaying 'd'ownloaded files - * since they are not supposed to be shown on the screen. - * (actually we may get 'curdoc' displayed from the first page...) */ - if (display_partial && (strchr(newdoc.address, '#')==NULL) && - (strncmp(newdoc.address, "LYNXDOWNLOAD:", 13)==0)) + if (display_partial && (strchr(newdoc.address, '#')==NULL)) display_partial = TRUE; else display_partial = FALSE; @@ -992,10 +988,10 @@ try_again: Newline = newdoc.line; #ifdef DISP_PARTIAL /* - * Override newdoc.line value with a new one if user + * Override newdoc.line with a new value if user * scrolled the document while downloading. */ - if (display_partial && (Newline_partial != 0)) + if (display_partial && (Newline_partial != newdoc.line)) Newline = Newline_partial; #endif /* DISP_PARTIAL */ @@ -5090,6 +5086,7 @@ check_add_bookmark_to_self: newdoc.safe = FALSE; } newdoc.internal_link = FALSE; + newdoc.line = curdoc.line; /* used for display_partial ! */ newdoc.link = 0; HTOutputFormat = HTAtom_for("www/download"); /* diff --git a/src/LYUtils.c b/src/LYUtils.c index bb30a96e..e4e4fa47 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -2893,9 +2893,9 @@ PUBLIC void size_change ARGS1( */ if (LYlines != old_lines || LYcols != old_cols) { recent_sizechange = TRUE; - } - CTRACE(tfp, "Window size changed from (%d,%d) to (%d,%d)\n", + CTRACE(tfp, "Window size changed from (%d,%d) to (%d,%d)\n", old_lines, old_cols, LYlines, LYcols); + } #ifdef SIGWINCH (void)signal (SIGWINCH, size_change); #endif /* SIGWINCH */ @@ -3249,6 +3249,10 @@ PRIVATE char *fmt_tempname ARGS3( static unsigned counter; char *leaf; + if (prefix == 0) + prefix = ""; + if (suffix == 0) + suffix = ""; strcpy(result, prefix); leaf = result + strlen(result); counter++; |