From 8f4762a842558800470354672a2b9087b4077d01 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Sat, 16 Jul 2005 22:35:11 +0000 Subject: [PATCH] cosmetic and #ifdef fixes git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2874 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ src/chars.c | 6 +++--- src/move.c | 10 ++++------ src/nano.c | 4 ++-- src/proto.h | 2 +- src/search.c | 14 +++++++------- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5dcf1744..53d8900d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -110,6 +110,10 @@ CVS code - do_gotolinecolumn() - Add parameter allow_update to control whether the screen is updated after moving. (DLR) + do_gotopos() + - Only include this function when DISABLE_SPELLER isn't defined, + as the alternate spell checking code is now the only place + where it's used. (DLR) - winio.c: edit_scroll(), edit_redraw(), edit_refresh() - Clean up and simplify. (DLR) diff --git a/src/chars.c b/src/chars.c index ead9da67..336c29c2 100644 --- a/src/chars.c +++ b/src/chars.c @@ -178,7 +178,7 @@ bool is_word_mbchar(const char *c, bool allow_punct) } /* c is a control character. It displays as ^@, ^?, or ^[ch], where ch - * is c + 64. We return that character. */ + * is (c + 64). We return that character. */ char control_rep(char c) { /* Treat newlines embedded in a line as encoded nulls. */ @@ -192,7 +192,7 @@ char control_rep(char c) #ifdef NANO_WIDE /* c is a wide control character. It displays as ^@, ^?, or ^[ch], - * where ch is c + 64. We return that wide character. */ + * where ch is (c + 64). We return that wide character. */ wchar_t control_wrep(wchar_t wc) { /* Treat newlines embedded in a line as encoded nulls. */ @@ -206,7 +206,7 @@ wchar_t control_wrep(wchar_t wc) #endif /* c is a multibyte control character. It displays as ^@, ^?, or ^[ch], - * where ch is c + 64. We return that multibyte character. */ + * where ch is (c + 64). We return that multibyte character. */ char *control_mbrep(const char *c, char *crep, int *crep_len) { assert(c != NULL && crep != NULL && crep_len != NULL); diff --git a/src/move.c b/src/move.c index 928fbdf1..ac0f79e7 100644 --- a/src/move.c +++ b/src/move.c @@ -214,13 +214,12 @@ void do_up(void) assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno); - /* Move the current line of the edit window up, and then get the - * equivalent x-coordinate of the current line. */ + /* Move the current line of the edit window up. */ openfile->current = openfile->current->prev; openfile->current_x = actual_x(openfile->current->data, openfile->placewewant); - /* If we're on the first row of the edit window, scroll the edit + /* If we're on the first line of the edit window, scroll the edit * window up one line if we're in smooth scrolling mode, or up half * a page if we're not. */ if (openfile->current_y == 0) @@ -251,13 +250,12 @@ void do_down(void) assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno); - /* Move the current line of the edit window down, and then get the - * equivalent x-coordinate of the current line. */ + /* Move the current line of the edit window down. */ openfile->current = openfile->current->next; openfile->current_x = actual_x(openfile->current->data, openfile->placewewant); - /* If we're on the last row of the edit window, scroll the edit + /* If we're on the last line of the edit window, scroll the edit * window down one line if we're in smooth scrolling mode, or down * half a page if we're not. */ if (openfile->current_y == editwinrows - 1) diff --git a/src/nano.c b/src/nano.c index 4533524b..7a5cbf0e 100644 --- a/src/nano.c +++ b/src/nano.c @@ -4556,10 +4556,10 @@ int main(int argc, char **argv) #ifndef DISABLE_JUSTIFY if (punct == NULL) - punct = mallocstrcpy(punct, ".?!"); + punct = mallocstrcpy(NULL, ".?!"); if (brackets == NULL) - brackets = mallocstrcpy(brackets, "'\")}]>"); + brackets = mallocstrcpy(NULL, "'\")}]>"); if (quotestr == NULL) quotestr = mallocstrcpy(NULL, diff --git a/src/proto.h b/src/proto.h index 38a1de2f..a69101f7 100644 --- a/src/proto.h +++ b/src/proto.h @@ -505,7 +505,7 @@ void do_replace(void); void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, bool interactive, bool save_pos, bool allow_update); void do_gotolinecolumn_void(void); -#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER) +#ifndef DISABLE_SPELLER void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t pos_pww); #endif diff --git a/src/search.c b/src/search.c index f3e263ac..fccf7b21 100644 --- a/src/search.c +++ b/src/search.c @@ -437,11 +437,11 @@ void findnextstr_wrap_reset(void) /* Search for a string. */ void do_search(void) { - size_t old_pww = openfile->placewewant; + filestruct *fileptr = openfile->current; size_t fileptr_x = openfile->current_x; + size_t old_pww = openfile->placewewant; int i; bool didfind; - filestruct *fileptr = openfile->current; #ifndef DISABLE_WRAPPING wrap_reset(); @@ -513,10 +513,10 @@ void do_search(void) /* Search for the next string without prompting. */ void do_research(void) { - size_t old_pww = openfile->placewewant; - size_t fileptr_x = openfile->current_x; - bool didfind; filestruct *fileptr = openfile->current; + size_t fileptr_x = openfile->current_x; + size_t old_pww = openfile->placewewant; + bool didfind; #ifndef DISABLE_WRAPPING wrap_reset(); @@ -880,10 +880,10 @@ ssize_t do_replace_loop(const char *needle, const filestruct /* Replace a string. */ void do_replace(void) { - int i; filestruct *edittop_save, *begin; size_t begin_x, pww_save; ssize_t numreplaced; + int i; if (ISSET(VIEW_MODE)) { print_view_warning(); @@ -1040,7 +1040,7 @@ void do_gotolinecolumn_void(void) openfile->placewewant + 1, FALSE, TRUE, FALSE, TRUE); } -#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER) +#ifndef DISABLE_SPELLER void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t pos_pww) {