From: Chris Allegretta Date: Sun, 21 Jul 2002 15:44:13 +0000 (+0000) Subject: Another DLR fixin: credits and DOS/Mac compatibility. Also get rid of those colons... X-Git-Tag: v1.1.10~8 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=c4e3d9ed01fc8657c27113d6e3604ea09b3d6760;p=nano.git Another DLR fixin: credits and DOS/Mac compatibility. Also get rid of those colons in ChangeLog after function names git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1237 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index ab0abbea..06af05e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ CVS Code - -- General: +- General - Translation updates (see po/ChangeLog for details). - Upgraded to gettext 0.11.2 (Jordi). Removed intl/ entirely, and a few more tweaks by gettextize. @@ -86,47 +86,49 @@ CVS Code - will corrupt the display.) (DLR) - Add command line option -I/--ignorercfiles to ignore /etc/nanorc and ~/.nanorc. (Carl Drinkwater) + - Fix minor bugs with importing certain text files in Mac + format. (DLR) - files.c: - new_file(): + new_file() - Make sure current_x is zero; this fixes a problem where the current cursor position wasn't reset when reading in a file in multibuffer mode. (David Benbennick) - read_file(), read_line(): + read_file(), read_line() - Rework to properly handle nulls in the input file, fix detection of binary files to properly mark a file as binary if the only binary characters it contains are ASCII 127's, and after reading the last line of a file that doesn't end in a newline, increment totsize. Remove previous kludge to set totsize properly. (DLR) - write_file(): + write_file() - Rework to properly handle nulls in the input file. When appending/prepending, don't change the current file's name to the name of the file it's being appended/prepended to. When writing a marked selection to a file, save and restore totsize so it isn't decreased by the size of the selection afterward. (DLR) - do_writeout(): + do_writeout() - Fix problem with formatstr's being defined as NULL when --enable-tiny is used. Since formatstr isn't ever used in tiny mode, don't bother even creating the variable. (David Benbennick and DLR) - do_insertfile(): + do_insertfile() - Memory leak fix. (David Benbennick) - get_full_path(): + get_full_path() - Memory leak fix. Also, make it properly interpret ~/ notation so, among other things, the option "--operatingdir ~" works. (David Benbennick) - check_operating_dir(): + check_operating_dir() - Memory leak fix. (David Benbennick) - cwd_tab_completion(): + cwd_tab_completion() - Changed a variable name: dirName -> dirname. (DLR) - append_slash_if_dir(), input_tab(): + append_slash_if_dir(), input_tab() - Changed variable names: lastWasTab -> lastwastab, matchBuf -> matchbuf. (DLR) - global.c: - free_toggles(): + free_toggles() - Only include if we're not using tiny mode. (David Benbennick) - toggle_init(): + toggle_init() - Remove global entries for search toggles, as they aren't really global. (DLR) - Don't reinititialize the toggles if they've already been @@ -136,10 +138,10 @@ CVS Code - above change. (David Benbennick) - If wrapping is disabled, don't include the toggle for it. (DLR) - shortcut_init(): + shortcut_init() - Rework IFHELP macro (David Benbennick). -- move.c: - page_down(), page_up(): +- move.c + page_down(), page_up() - Put sanity checks for current_x back in, to avoid rare segfaults (oops). Now, however, they are only called when placewewant is zero instead of being called unconditionally; @@ -147,52 +149,52 @@ CVS Code - - nanorc.sample: - Put in much less crappy example regex rules for c-file. - nano.c: - do_char(): + do_char() - Fix a problem where, if ENABLE_COLOR wasn't used, typing characters on a marked line before the beginning of the mark would make the highlight short by one. (David Benbennick) - die(): + die() - Rework slightly to remove redundant printing of last message and print all messages after resetting the terminal. (DLR) - global_init(): + global_init() - Call die_too_small() when fill is 0. (DLR) - usage(): + usage() - List the options that are ignored for the purpose of Pico compatibility, and make some minor consistency fixes. (DLR) - do_next_word(), do_prev_word(): + do_next_word(), do_prev_word() - Fix a problem where highlighting isn't done properly after calling either of these, and another problem where the cursor would move back too far in certain cases with do_prev_word(). (David Benbennick) - do_backspace(): + do_backspace() - Make sure placewewant is set properly, and that the mark is moved backwards. (David Benbennick) - do_delete(): + do_delete() - Make sure placewewant is set properly, to match Pico's behavior. (DLR) - clear_filename(): + clear_filename() - Remove this function, as it has unneeded functionality, is short enough to be inlined, and is only called in two spots anyway. (DLR) - do_int_spell(), do_alt_spell(): + do_int_spell(), do_alt_spell() - Rework to save the marked selection before doing spell checking and restore it afterward. (DLR) - do_cont(): + do_cont() - Handle the case where the window was resized while we were stopped. (David Benbennick) - handle_sigwinch(): + handle_sigwinch() - Make sure we adjust fill when the window is resized. (David Benbennick) - Call die_too_small() when fill is 0. (DLR) - help_init(): + help_init() - Since the return value of snprintf() isn't well defined, use sprintf() instead. (David Benbennick) - do_toggle(): + do_toggle() - Since the search mode toggles aren't global anymore, we don't need to explicitly block them here anymore (which will end up blocking the global backup mode toggle, which is the same as the backwards search toggle). (DLR) - main(): + main() - Rework to blank out filename manually before doing anything with it, instead of calling clear_filename() in two places. Make startline an int instead of a long, since it's supposed to @@ -212,15 +214,15 @@ CVS Code - - Remove external declaration of the global int fill, since it's now static. (DLR) - rcfile.c: - parse_rcfile(): + parse_rcfile() - Add David Benbennick's fix that allows fill to accept negative numbers properly. Specifically, use strtol() there instead of atoi() so that errors can be detected. Also adapted for tabsize by DLR. - parse_next_regex(), colortoint(): + parse_next_regex(), colortoint() - Only include if ENABLE_COLOR is defined. (DLR) - search.c: - search_init(): + search_init() - Since the search mode toggles aren't global anymore, rework the part of this function referencing them so that they still work. (DLR) @@ -228,7 +230,7 @@ CVS Code - - Fix a problem where the first character of buf was overwritten if the last search string was one third the number of columns plus one. (David Benbennick) - findnextstr(): + findnextstr() - Update the current line at current_x if we don't find a match. Also, pass current_x_find to strstrwrapper() so we know whether we're at the beginning of a string or not (see changes to @@ -236,7 +238,7 @@ CVS Code - do_gotoline(): - Make sure placewewant is zero after we go to a line. (David Benbennick) - do_gotopos(): + do_gotopos() - Simplify the sanity check to only put x within the range of the current line; don't call actual_x() anymore. (DLR) - utils.c: @@ -244,30 +246,34 @@ CVS Code - other than the terminating null in strings to newlines and back; they're used to handle null characters in files properly. (DLR) - lowercase(): + lowercase() - Remove, since it isn't actually used anywhere. (David Benbennick) - strstrwrapper(): Set REG_NOTBOL when we're not at the beginning of a + strstrwrapper() + - Set REG_NOTBOL when we're not at the beginning of a string, to avoid false positives when searching for regular expressions prefixed with ^. Make it take a new parameter, line_pos, to determine where we are in the string. (DLR) - check_wildcard_match(): + check_wildcard_match() - Changed variable names: retryPat -> retrypat, retryText -> retrytext. (DLR) - winio.c: - actual_x_from_start(): + actual_x_from_start() - Overhaul to make cursor placement more like that of Pico: add sanity check for i, and then place i as close to the value of xplus column as possible. This change is most noticeable when moving down through binary files. (DLR) - nanogetstr(): + do_credits() + - Fix for the i18ned credits so it will compile with -pedantic + (DLR & Chris). + nanogetstr() - After the user presses Enter at the prompt, refresh the edit window in case there's a list of possible filename matches (left over from attempted tab completion) on it. (DLR) - titlebar(): + titlebar() - Tweak text spacing and printing so that the titlebar text looks better on smaller terminals. (Carl Drinkwater) - update_line(): + update_line() - When marking control characters, make sure the mark moves forward by two characters instead of one. Rework control character display routine to display newlines within the line @@ -276,14 +282,14 @@ CVS Code - beforehand) as ^@'s. (DLR) - Fix to properly treat ASCII 128-159 as control characters. (DLR) - statusbar(): + statusbar() - Limit statusbar display to the number of columns less four, and don't allow it to go over its original row. (David Benbennick) - do_help(): + do_help() - Add support for the handled keyboard escape sequences in the help menu, as they are needed with some terminals (e.g. xterm with TERM=ansi). (DLR) - do_replace_highlight(): + do_replace_highlight() - When using regexps, make sure the highlight is the length of the search result and not the regexp string. (DLR) - configure.ac: @@ -295,6 +301,7 @@ CVS Code - - Completed a bit (Jordi). - Fixed David Benbennick's email address. (David Benbennick) - Typo fix. (DLR) + GNU nano 1.1.9 - 05/12/2002 - General: - Typos n misspellings all over the place (David Benbennick). diff --git a/files.c b/files.c index 9d5d113f..6e65d811 100644 --- a/files.c +++ b/files.c @@ -259,6 +259,14 @@ int read_file(FILE *f, const char *filename, int quiet) /* Did we not get a newline but still have stuff to do? */ if (len > 0) { +#ifndef NANO_SMALL + /* If file conversion isn't disabled, the last character in + this file is a CR and fileformat isn't set yet, make sure + it's set to Mac format */ + if (!ISSET(NO_CONVERT) && buf[len - 1] == '\r' && !fileformat) + fileformat = 2; +#endif + /* read in the LAST line properly */ fileptr = read_line(buf, fileptr, &line1ins, len); @@ -266,6 +274,22 @@ int read_file(FILE *f, const char *filename, int quiet) totsize++; buf[0] = '\0'; } +#ifndef NANO_SMALL + else { + /* If file conversion isn't disabled and the last character in + this file is a CR, read it in properly as a (Mac format) + line */ + if (!ISSET(NO_CONVERT) && input == '\r') { + buf[0] = input; + buf[1] = '\0'; + len = 1; + fileptr = read_line(buf, fileptr, &line1ins, len); + num_lines++; + totsize++; + buf[0] = '\0'; + } + } +#endif /* Did we even GET a file if we don't already have one? */ if (totsize == 0 || fileptr == NULL) { diff --git a/winio.c b/winio.c index 65166c5e..69ea4efc 100644 --- a/winio.c +++ b/winio.c @@ -1796,24 +1796,21 @@ void do_replace_highlight(int highlight_flag, const char *word) #ifdef NANO_EXTRA #define CREDIT_LEN 52 +#define XLCREDIT_LEN 8 + void do_credits(void) { int i, j = 0, k, place = 0, start_x; - const char *what; - const char *nanotext = _("The nano text editor"); - const char *version = _("version "); - const char *brought = _("Brought to you by:"); - const char *specialthx = _("Special thanks to:"); - const char *fsf = _("The Free Software Foundation"); - const char *ncurses = _("For ncurses:"); - const char *anyonelse = _("and anyone else we forgot..."); - const char *thankyou = _("Thank you for using nano!\n"); - - const char *credits[CREDIT_LEN] = { nanotext, - version, + + char *what; + char *xlcredits[XLCREDIT_LEN]; + + char *credits[CREDIT_LEN] = { + "0", /* "The nano text editor" */ + "1", /* "version" */ VERSION, "", - brought, + "2", /* "Brought to you by:" */ "Chris Allegretta", "Jordi Mallach", "Adam Rogoyski", @@ -1835,28 +1832,37 @@ void do_credits(void) "Ryan Krebs", "Albert Chin", "", - specialthx, + "3", /* "Special thanks to:" */ "Plattsburgh State University", "Benet Laboratories", "Amy Allegretta", "Linda Young", "Jeremy Robichaud", "Richard Kolb II", - fsf, + "4", /* "The Free Software Foundation" */ "Linus Torvalds", - ncurses, + "5", /* "For ncurses:" */ "Thomas Dickey", "Pavel Curtis", "Zeyd Ben-Halim", "Eric S. Raymond", - anyonelse, - thankyou, + "6", /* "and anyone else we forgot..." */ + "7", /* "Thank you for using nano!\n" */ "", "", "", "", "(c) 1999-2002 Chris Allegretta", "", "", "", "", "www.nano-editor.org" }; + xlcredits[0] = _("The nano text editor"); + xlcredits[1] = _("version "); + xlcredits[2] = _("Brought to you by:"); + xlcredits[3] = _("Special thanks to:"); + xlcredits[4] = _("The Free Software Foundation"); + xlcredits[5] = _("For ncurses:"); + xlcredits[6] = _("and anyone else we forgot..."); + xlcredits[7] = _("Thank you for using nano!\n"); + curs_set(0); nodelay(edit, TRUE); blank_bottombars(); @@ -1873,9 +1879,16 @@ void do_credits(void) i--) { mvwaddstr(edit, i * 2 - k, 0, hblank); - if (place - (editwinrows / 2 - 1 - i) < CREDIT_LEN) + if (place - (editwinrows / 2 - 1 - i) < CREDIT_LEN) { what = credits[place - (editwinrows / 2 - 1 - i)]; - else + + /* God I've missed hacking. If what is exactly + 1 char long, it's a sentinel for a translated + string, so use that instead. This means no + thanking people with 1 character long names ;-) */ + if (strlen(what) == 1) + what = xlcredits[atoi(what)]; + } else what = ""; start_x = COLS / 2 - strlen(what) / 2 - 1;