From e0d802915f2d49b7478648b7e096333e4cfbb961 Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Sat, 31 May 2008 23:12:34 +0000 Subject: [PATCH] Fix for conflicts with AIX curses variables, from William Jojo git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_2_0_branch/nano@4261 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/files.c | 12 ++++++------ src/proto.h | 2 +- src/text.c | 20 ++++++++++---------- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6d9c570..9a773908 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ CVS code - +- General: + - Fix for conflicts with AIX curses variables, from William + Jojo - nano.c: - Fix for segfault on resize by Andreas Amann diff --git a/src/files.c b/src/files.c index a74054d2..bb556bf4 100644 --- a/src/files.c +++ b/src/files.c @@ -2384,7 +2384,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool } else if (!*lastwastab || num_matches < 2) *lastwastab = TRUE; else { - int longest_name = 0, columns, editline = 0; + int longest_name = 0, ncols, editline = 0; /* Now we show a list of the available choices. */ assert(num_matches > 1); @@ -2409,7 +2409,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool /* 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); + ncols = (COLS + 1) / (longest_name + 2); /* Blank the edit window, and print the matches out * there. */ @@ -2423,11 +2423,11 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool char *disp; wmove(edit, editline, (longest_name + 2) * - (match % columns)); + (match % ncols)); - if (match % columns == 0 && + if (match % ncols == 0 && editline == editwinrows - 1 && - num_matches - match > columns) { + num_matches - match > ncols) { waddstr(edit, _("(more)")); break; } @@ -2437,7 +2437,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool waddstr(edit, disp); free(disp); - if ((match + 1) % columns == 0) + if ((match + 1) % ncols == 0) editline++; } diff --git a/src/proto.h b/src/proto.h index 43b8746c..9319ab95 100644 --- a/src/proto.h +++ b/src/proto.h @@ -649,7 +649,7 @@ bool do_wrap(filestruct *line); #if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY) ssize_t break_line(const char *line, ssize_t goal #ifndef DISABLE_HELP - , bool newline + , bool newln #endif ); #endif diff --git a/src/text.c b/src/text.c index 166c182e..ac6f473e 100644 --- a/src/text.c +++ b/src/text.c @@ -761,7 +761,7 @@ bool do_wrap(filestruct *line) * blank, as does a '\n' if newline is TRUE. */ ssize_t break_line(const char *line, ssize_t goal #ifndef DISABLE_HELP - , bool newline + , bool newln #endif ) { @@ -781,13 +781,13 @@ ssize_t break_line(const char *line, ssize_t goal if (is_blank_mbchar(line) #ifndef DISABLE_HELP - || (newline && *line == '\n') + || (newln && *line == '\n') #endif ) { blank_loc = cur_loc; #ifndef DISABLE_HELP - if (newline && *line == '\n') + if (newln && *line == '\n') break; #endif } @@ -810,7 +810,7 @@ ssize_t break_line(const char *line, ssize_t goal if (is_blank_mbchar(line) #ifndef DISABLE_HELP - || (newline && *line == '\n') + || (newln && *line == '\n') #endif ) { if (!found_blank) @@ -834,11 +834,11 @@ ssize_t break_line(const char *line, ssize_t goal while (*line != '\0' && (is_blank_mbchar(line) #ifndef DISABLE_HELP - || (newline && *line == '\n') + || (newln && *line == '\n') #endif )) { #ifndef DISABLE_HELP - if (newline && *line == '\n') + if (newln && *line == '\n') break; #endif @@ -2361,7 +2361,7 @@ void do_spell(void) void do_wordlinechar_count(void) { size_t words = 0, chars = 0; - ssize_t lines = 0; + ssize_t nlines = 0; size_t current_x_save = openfile->current_x; size_t pww_save = openfile->placewewant; filestruct *current_save = openfile->current; @@ -2396,7 +2396,7 @@ void do_wordlinechar_count(void) /* Get the total line and character counts, as "wc -l" and "wc -c" * do, but get the latter in multibyte characters. */ if (old_mark_set) { - lines = openfile->filebot->lineno - + nlines = openfile->filebot->lineno - openfile->fileage->lineno + 1; chars = get_totsize(openfile->fileage, openfile->filebot); @@ -2405,7 +2405,7 @@ void do_wordlinechar_count(void) unpartition_filestruct(&filepart); openfile->mark_set = TRUE; } else { - lines = openfile->filebot->lineno; + nlines = openfile->filebot->lineno; chars = openfile->totsize; } @@ -2417,7 +2417,7 @@ void do_wordlinechar_count(void) /* Display the total word, line, and character counts on the * statusbar. */ statusbar(_("%sWords: %lu Lines: %ld Chars: %lu"), old_mark_set ? - _("In Selection: ") : "", (unsigned long)words, (long)lines, + _("In Selection: ") : "", (unsigned long)words, (long)nlines, (unsigned long)chars); } #endif /* !NANO_TINY */ -- 2.39.5