diff --git a/ChangeLog b/ChangeLog index 6706322b..ab0abbea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -78,6 +78,12 @@ CVS Code - including all the header files, as rcfile.c does; this fixes a warning about ANSI C'S inability to handle blank files. (DLR) + - Add new function is_cntrl_char() as a wrapper for iscntrl(); + this is needed to treat ASCII 0x80-0x9f as control characters + consistently. (Without this, they will only be treated as + such when gettext is used; when it isn't used, they will be + printed as-is and be interpreted as commands by xterm, which + will corrupt the display.) (DLR) - Add command line option -I/--ignorercfiles to ignore /etc/nanorc and ~/.nanorc. (Carl Drinkwater) - files.c: @@ -161,6 +167,9 @@ CVS Code - do_backspace(): - Make sure placewewant is set properly, and that the mark is moved backwards. (David Benbennick) + do_delete(): + - Make sure placewewant is set properly, to match Pico's + behavior. (DLR) clear_filename(): - Remove this function, as it has unneeded functionality, is short enough to be inlined, and is only called in two spots @@ -197,6 +206,8 @@ CVS Code - numbers properly in parse_rcfile() (see below) to the handlers for the -r and -T options as well, so that -r/-T 0 can be treated separately from -r/-T string. (DLR) + - Fix so that Esc-Esc-Space is properly treated as Ctrl-Space. + (DLR) - proto.h: - Remove external declaration of the global int fill, since it's now static. (DLR) @@ -263,9 +274,8 @@ CVS Code - (which should never occur under normal circumstances; they will only be there if the line had nulls in it and was unsunder()ed beforehand) as ^@'s. (DLR) - - Display ASCII 0x80-0x9f as backslashes followed by 3-digit - octal values to keep xterm from screwing up the display when - some of them are printed as-is. (David Benbennick) + - Fix to properly treat ASCII 128-159 as control characters. + (DLR) statusbar(): - Limit statusbar display to the number of columns less four, and don't allow it to go over its original row. (David Benbennick) diff --git a/cut.c b/cut.c index 97c13009..aa4e2c69 100644 --- a/cut.c +++ b/cut.c @@ -126,7 +126,7 @@ void cut_marked_segment(filestruct *top, size_t top_x, filestruct *bot, top->data = (char *)nrealloc(top->data, sizeof(char) * newsize); } else { - totsize -= bot_x; + totsize -= bot_x + 1; /* Here, the remainder line might get longer, so we realloc it first. */ @@ -150,7 +150,7 @@ void cut_marked_segment(filestruct *top, size_t top_x, filestruct *bot, if (!destructive) tmp = copy_node(tmp); else - totsize -= strlen(tmp->data); + totsize -= strlen(tmp->data) + 1; add_to_cutbuffer(tmp); tmp = next; } diff --git a/files.c b/files.c index bb4fdcd4..9d5d113f 100644 --- a/files.c +++ b/files.c @@ -184,10 +184,10 @@ int read_file(FILE *f, const char *filename, int quiet) } /* Read the entire file into file struct */ while ((input_int = getc(f)) != EOF) { - input = (char) input_int; + input = (char)input_int; #ifndef NANO_SMALL - if (!ISSET(NO_CONVERT) && iscntrl((int) input) && input != '\t' - && input != '\r' && input != '\n') { + if (!ISSET(NO_CONVERT) && is_cntrl_char((int)input) + && input != '\t' && input != '\r' && input != '\n') { /* If the file has binary chars in it, don't stupidly assume it's a DOS or Mac formatted file! */ SET(NO_CONVERT); @@ -1788,6 +1788,7 @@ int do_writeout(char *path, int exiting, int append) return do_writeout(answer, exiting, append); } else #endif +#ifndef NANO_SMALL if (i == TOGGLE_DOS_KEY) { UNSET(MAC_FILE); TOGGLE(DOS_FILE); @@ -1796,10 +1797,11 @@ int do_writeout(char *path, int exiting, int append) UNSET(DOS_FILE); TOGGLE(MAC_FILE); return(do_writeout(answer, exiting, append)); -#ifndef NANO_SMALL } else if (i == TOGGLE_BACKUP_KEY) { TOGGLE(BACKUP_FILE); return(do_writeout(answer, exiting, append)); +#else + if (0) { #endif } else if (i == NANO_PREPEND_KEY) return(do_writeout(answer, exiting, append == 2 ? 0 : 2)); @@ -2040,7 +2042,7 @@ char **username_tab_completion(char *buf, int *num_matches) char **cwd_tab_completion(char *buf, int *num_matches) { - char *dirName, *dirtmp = NULL, *tmp = NULL, *tmp2 = NULL; + char *dirname, *dirtmp = NULL, *tmp = NULL, *tmp2 = NULL; char **matches = (char **) NULL; DIR *dir; struct dirent *next; @@ -2052,23 +2054,23 @@ char **cwd_tab_completion(char *buf, int *num_matches) /* Okie, if there's a / in the buffer, strip out the directory part */ if (buf[0] != '\0' && strstr(buf, "/")) { - dirName = charalloc(strlen(buf) + 1); + dirname = charalloc(strlen(buf) + 1); tmp = buf + strlen(buf); while (*tmp != '/' && tmp != buf) tmp--; tmp++; - strncpy(dirName, buf, tmp - buf + 1); - dirName[tmp - buf] = '\0'; + strncpy(dirname, buf, tmp - buf + 1); + dirname[tmp - buf] = '\0'; } else { #ifdef PATH_MAX - if ((dirName = getcwd(NULL, PATH_MAX+1)) == NULL) + if ((dirname = getcwd(NULL, PATH_MAX + 1)) == NULL) #else /* The better, but apparently segfault-causing way */ - if ((dirName = getcwd(NULL, 0)) == NULL) + if ((dirname = getcwd(NULL, 0)) == NULL) #endif /* PATH_MAX */ return matches; else @@ -2076,23 +2078,23 @@ char **cwd_tab_completion(char *buf, int *num_matches) } #ifdef DEBUG - fprintf(stderr, "\nDir = %s\n", dirName); + fprintf(stderr, "\nDir = %s\n", dirname); fprintf(stderr, "\nbuf = %s\n", buf); fprintf(stderr, "\ntmp = %s\n", tmp); #endif - dirtmp = real_dir_from_tilde(dirName); - free(dirName); - dirName = dirtmp; + dirtmp = real_dir_from_tilde(dirname); + free(dirname); + dirname = dirtmp; #ifdef DEBUG - fprintf(stderr, "\nDir = %s\n", dirName); + fprintf(stderr, "\nDir = %s\n", dirname); fprintf(stderr, "\nbuf = %s\n", buf); fprintf(stderr, "\ntmp = %s\n", tmp); #endif - dir = opendir(dirName); + dir = opendir(dirname); if (!dir) { /* Don't print an error, just shut up and return */ *num_matches = 0; @@ -2119,8 +2121,8 @@ char **cwd_tab_completion(char *buf, int *num_matches) before we check it */ if (operating_dir) { - tmp2 = charalloc(strlen(dirName) + strlen(next->d_name) + 2); - strcpy(tmp2, dirName); + tmp2 = charalloc(strlen(dirname) + strlen(next->d_name) + 2); + strcpy(tmp2, dirname); strcat(tmp2, "/"); strcat(tmp2, next->d_name); if (check_operating_dir(tmp2, 1)) { @@ -2342,7 +2344,6 @@ char *input_tab(char *buf, int place, int *lastwastab, int *newplace, int *list) *list = 1; } else beep(); - } /* Only refresh the edit window if we don't have a list of filename @@ -2357,7 +2358,8 @@ char *input_tab(char *buf, int place, int *lastwastab, int *newplace, int *list) #ifndef DISABLE_BROWSER /* Return the stat of the file pointed to by path */ -struct stat filestat(const char *path) { +struct stat filestat(const char *path) +{ struct stat st; stat(path, &st); @@ -2367,7 +2369,8 @@ struct stat filestat(const char *path) { /* Our sort routine for file listings - sort directories before * files, and then alphabetically */ -int diralphasort(const void *va, const void *vb) { +int diralphasort(const void *va, const void *vb) +{ struct stat file1info, file2info; char *a = *(char **)va, *b = *(char **)vb; int aisdir, bisdir; @@ -2675,7 +2678,11 @@ char *do_browser(char *inpath) /* SPK for '.' path, get the current path via getcwd */ if (!strcmp(path, "./..")) { free(path); +#ifdef PATH_MAX + path = getcwd(NULL, PATH_MAX + 1); +#else path = getcwd(NULL, 0); +#endif striponedir(path); align(&path); free_charptrarray(filelist, numents); @@ -2864,7 +2871,7 @@ char *do_browse_from(char *inpath) /* If there's no / in the string, we may as well start from . */ if (tmp == NULL || *tmp == '\0' || !strstr(tmp, "/")) { #ifdef PATH_MAX - char *from = getcwd(NULL, PATH_MAX+1); + char *from = getcwd(NULL, PATH_MAX + 1); #else char *from = getcwd(NULL, 0); #endif /* PATH_MAX */ @@ -2883,4 +2890,4 @@ char *do_browse_from(char *inpath) return do_browser(tmp); } -#endif +#endif /* !DISABLE_BROWSER */ diff --git a/nano.1 b/nano.1 index 284a10aa..603c9c57 100644 --- a/nano.1 +++ b/nano.1 @@ -6,7 +6,7 @@ .\" Public License for copying conditions. There is NO warranty. .\" .\" $Id$ -.TH NANO 1 "July 6, 2002" +.TH NANO 1 "July 14, 2002" .\" Please adjust this date whenever revising the manpage. .\" .SH NAME @@ -41,6 +41,9 @@ Write file in DOS format. .B \-F (\-\-multibuffer) Enable multiple file buffers, if available. .TP +.B \-I (\-\-ignorercfiles) +Don't look at /etc/nanorc or ~/.nanorc, if nanorc support is available. +.TP .B \-K (\-\-keypad) Do not use the ncurses keypad() call unless necessary. Try this flag if you find that the arrow keys on the numeric keypad do not work for you diff --git a/nano.1.html b/nano.1.html index 6f494ae7..7c07baab 100644 --- a/nano.1.html +++ b/nano.1.html @@ -3,7 +3,7 @@ Content-type: text/html