From 7dc531a8011b323da5ade7185a28652a3529121e Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Mon, 18 Jul 2005 18:43:39 +0000 Subject: [PATCH] miscellaneous minor fixes git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2892 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/files.c | 15 +++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3af2dd5d..96a121f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -83,6 +83,9 @@ CVS code - - Assert that filename isn't NULL, and don't do anything special if it's blank, as the the former case shouldn't occur, and the latter case is now handled elsewhere. (DLR) + input_tab() + - Make columns an int instead of a size_t, since it's limited by + COLS. (DLR) - global.c: shortcut_init() - Simplify wording of nano_gotoline_msg. (Jordi and Ken Tyler) diff --git a/src/files.c b/src/files.c index 457c9e7c..474b6acb 100644 --- a/src/files.c +++ b/src/files.c @@ -2119,8 +2119,8 @@ char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list) while (TRUE) { for (match = 1; match < num_matches; match++) { - /* Get the number of single-byte characters that match1 - * and match2 have in common. */ + /* Get the number of single-byte characters that all the + * matches have in common. */ match1_mb_len = parse_mbchar(matches[0] + common_len, match1_mb, NULL, NULL); match2_mb_len = parse_mbchar(matches[match] + @@ -2161,7 +2161,7 @@ char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list) beep(); /* If there is more of a match to display on the statusbar, show - * it. We reset lastwastab to FALSE: it requires hitting Tab + * it. We reset lastwastab to FALSE: it requires pressing Tab * twice in succession with no statusbar changes to see a match * list. */ if (common_len != *place) { @@ -2176,8 +2176,7 @@ char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list) } else if (*lastwastab == FALSE || num_matches < 2) *lastwastab = TRUE; else { - int longest_name = 0, editline = 0; - size_t columns; + int longest_name = 0, columns, editline = 0; /* Now we show a list of the available choices. */ assert(num_matches > 1); @@ -2199,9 +2198,9 @@ char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list) assert(longest_name <= COLS - 1); - /* Each column will be longest_name + 2 characters wide, - * i.e, two spaces between columns, except that there will - * be only one space after the last column. */ + /* Each column will be (longest_name + 2) columns wide, i.e, + * two spaces between columns, except that there will be + * only one space after the last column. */ columns = (COLS + 1) / (longest_name + 2); /* Blank the edit window, and print the matches out