From 17cf833b9c0631d933edcdd298099821c1634707 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensberg@justemail.net> Date: Mon, 30 May 2016 09:09:36 +0200 Subject: [PATCH] tweaks: normalize some whitespace --- src/browser.c | 12 +++++------- src/chars.c | 6 +++--- src/files.c | 20 +++++++++++--------- src/help.c | 4 ++-- src/nano.c | 15 +++++++-------- src/nano.h | 4 ++-- src/prompt.c | 2 +- src/text.c | 11 +++++------ src/winio.c | 6 +++--- 9 files changed, 39 insertions(+), 41 deletions(-) diff --git a/src/browser.c b/src/browser.c index 10f0cad8..7fda9292 100644 --- a/src/browser.c +++ b/src/browser.c @@ -311,16 +311,14 @@ char *do_browser(char *path) #endif if (stat(filelist[selected], &st) == -1) { - /* We can't open this file for some reason. - * Complain. */ - statusline(ALERT, _("Error reading %s: %s"), + /* We can't open this file for some reason. Complain. */ + statusline(ALERT, _("Error reading %s: %s"), filelist[selected], strerror(errno)); - continue; + continue; } if (!S_ISDIR(st.st_mode)) { - /* We've successfully opened a file, we're done, so - * get out. */ + /* We've successfully opened a file, so we're done. */ retval = mallocstrcpy(NULL, filelist[selected]); break; } @@ -395,7 +393,7 @@ char *do_browse_from(const char *inpath) beep(); napms(1200); return NULL; - } else + } else align(&path); } } diff --git a/src/chars.c b/src/chars.c index dc46d49d..a93d41d2 100644 --- a/src/chars.c +++ b/src/chars.c @@ -934,9 +934,9 @@ bool has_blank_mbchars(const char *s) bool is_valid_unicode(wchar_t wc) { return ((0 <= wc && wc <= 0xD7FF) || - (0xE000 <= wc && wc <= 0xFDCF) || - (0xFDF0 <= wc && wc <= 0xFFFD) || - (0xFFFF < wc && wc <= 0x10FFFF && (wc & 0xFFFF) <= 0xFFFD)); + (0xE000 <= wc && wc <= 0xFDCF) || + (0xFDF0 <= wc && wc <= 0xFFFD) || + (0xFFFF < wc && wc <= 0x10FFFF && (wc & 0xFFFF) <= 0xFFFD)); } #endif diff --git a/src/files.c b/src/files.c index c76ac90c..946c737b 100644 --- a/src/files.c +++ b/src/files.c @@ -288,7 +288,7 @@ int delete_lockfile(const char *lockfilename) { if (unlink(lockfilename) < 0 && errno != ENOENT) { statusline(MILD, _("Error deleting lock file %s: %s"), lockfilename, - strerror(errno)); + strerror(errno)); return -1; } return 1; @@ -411,7 +411,7 @@ bool open_buffer(const char *filename, bool undoable) { bool new_buffer = (openfile == NULL #ifndef DISABLE_MULTIBUFFER - || ISSET(MULTIBUFFER) + || ISSET(MULTIBUFFER) #endif ); /* Whether we load into this buffer or a new one. */ @@ -2261,7 +2261,7 @@ int do_writeout(bool exiting) const char *formatstr, *backupstr; formatstr = (openfile->fmt == DOS_FILE) ? _(" [DOS Format]") : - (openfile->fmt == MAC_FILE) ? _(" [Mac Format]") : ""; + (openfile->fmt == MAC_FILE) ? _(" [Mac Format]") : ""; backupstr = ISSET(BACKUP_FILE) ? _(" [Backup]") : ""; @@ -2271,13 +2271,13 @@ int do_writeout(bool exiting) * the command line. */ if (openfile->mark_set && !exiting && !ISSET(RESTRICTED)) msg = (append == PREPEND) ? _("Prepend Selection to File") : - (append == APPEND) ? _("Append Selection to File") : - _("Write Selection to File"); + (append == APPEND) ? _("Append Selection to File") : + _("Write Selection to File"); else #endif /* !NANO_TINY */ msg = (append == PREPEND) ? _("File Name to Prepend to") : - (append == APPEND) ? _("File Name to Append to") : - _("File Name to Write"); + (append == APPEND) ? _("File Name to Append to") : + _("File Name to Write"); present_path = mallocstrcpy(present_path, "./"); @@ -2987,13 +2987,15 @@ int check_dotnano(void) if (stat(nanodir, &dirstat) == -1) { if (mkdir(nanodir, S_IRWXU | S_IRWXG | S_IRWXO) == -1) { history_error(N_("Unable to create directory %s: %s\n" - "It is required for saving/loading search history or cursor positions.\n"), + "It is required for saving/loading " + "search history or cursor positions.\n"), nanodir, strerror(errno)); ret = 0; } } else if (!S_ISDIR(dirstat.st_mode)) { history_error(N_("Path %s is not a directory and needs to be.\n" - "Nano will be unable to load or save search history or cursor positions.\n"), + "Nano will be unable to load or save " + "search history or cursor positions.\n"), nanodir); ret = 0; } diff --git a/src/help.c b/src/help.c index 66716634..2837c822 100644 --- a/src/help.c +++ b/src/help.c @@ -446,7 +446,7 @@ void help_init(void) /* First see how many toggles there are. */ for (s = sclist; s != NULL; s = s->next) - maximum = (s->toggle && s->ordinal > maximum) ? s->ordinal : maximum; + maximum = (s->toggle && s->ordinal > maximum) ? s->ordinal : maximum; /* Now show them in the original order. */ while (counter < maximum) { @@ -454,7 +454,7 @@ void help_init(void) for (s = sclist; s != NULL; s = s->next) if (s->toggle && s->ordinal == counter) { ptr += sprintf(ptr, "%s\t\t%s %s\n", (s->menus == MMAIN ? s->keystr : ""), - _(flagtostr(s->toggle)), _("enable/disable")); + _(flagtostr(s->toggle)), _("enable/disable")); if (s->toggle == NO_COLOR_SYNTAX || s->toggle == TABS_TO_SPACES) ptr += sprintf(ptr, "\n"); break; diff --git a/src/nano.c b/src/nano.c index 4b535a6f..5c1b78a0 100644 --- a/src/nano.c +++ b/src/nano.c @@ -530,7 +530,7 @@ openfilestruct *make_new_opennode(void) void unlink_opennode(openfilestruct *fileptr) { assert(fileptr != NULL && fileptr->prev != NULL && fileptr->next != NULL && - fileptr != fileptr->prev && fileptr != fileptr->next); + fileptr != fileptr->prev && fileptr != fileptr->next); fileptr->prev->next = fileptr->next; fileptr->next->prev = fileptr->prev; @@ -1111,9 +1111,8 @@ void do_exit(void) if (ISSET(TEMP_FILE)) no_current_file_name_warning(); - i = do_yesno_prompt(FALSE, - _("Save modified buffer? (Answering \"No\" will" - " DISCARD changes.) ")); + i = do_yesno_prompt(FALSE, _("Save modified buffer? " + "(Answering \"No\" will DISCARD changes.) ")); } #ifdef DEBUG @@ -1782,8 +1781,8 @@ int do_mouse(void) if (ISSET(SOFTWRAP)) { size_t i = 0; for (openfile->current = openfile->edittop; - openfile->current->next && i < mouse_y; - openfile->current = openfile->current->next, i++) { + openfile->current->next && i < mouse_y; + openfile->current = openfile->current->next, i++) { openfile->current_y = i; i += strlenpt(openfile->current->data) / COLS; } @@ -1812,10 +1811,10 @@ int do_mouse(void) { /* Move to where the click occurred. */ for (; openfile->current_y < mouse_y && openfile->current != - openfile->filebot; openfile->current_y++) + openfile->filebot; openfile->current_y++) openfile->current = openfile->current->next; for (; openfile->current_y > mouse_y && openfile->current != - openfile->fileage; openfile->current_y--) + openfile->fileage; openfile->current_y--) openfile->current = openfile->current->prev; openfile->current_x = actual_x(openfile->current->data, diff --git a/src/nano.h b/src/nano.h index 829799d2..468eac70 100644 --- a/src/nano.h +++ b/src/nano.h @@ -434,9 +434,9 @@ typedef struct openfilestruct { #ifndef DISABLE_NANORC typedef struct rcoption { - const char *name; + const char *name; /* The name of the rcfile option. */ - long flag; + long flag; /* The flag associated with it, if any. */ } rcoption; #endif diff --git a/src/prompt.c b/src/prompt.c index 27e777f6..0c942426 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -619,7 +619,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs, #endif if (allow_tabs) answer = input_tab(answer, allow_files, &statusbar_x, - &tabbed, refresh_func, listed); + &tabbed, refresh_func, listed); update_the_statusbar(); } else diff --git a/src/text.c b/src/text.c index 9132cfb3..ce0dba53 100644 --- a/src/text.c +++ b/src/text.c @@ -220,13 +220,13 @@ void do_cutword(bool backward) /* Delete a word leftward. */ void do_cut_prev_word(void) { - do_cutword(TRUE); + do_cutword(TRUE); } /* Delete a word rightward. */ void do_cut_next_word(void) { - do_cutword(FALSE); + do_cutword(FALSE); } #endif /* !NANO_TINY */ @@ -2519,7 +2519,7 @@ void do_justify(bool full_justify) if (func == do_uncut_text #ifndef NANO_TINY - || func == do_undo + || func == do_undo #endif ) { /* Splice the justify buffer back into the file, but only if we @@ -3049,15 +3049,14 @@ const char *do_alt_speller(char *tempfile_name) } #endif - /* Replace the text of the current buffer with the spell-checked - * text. */ + /* Replace the text of the current buffer with the spell-checked text. */ replace_buffer(tempfile_name); #ifndef NANO_TINY if (old_mark_set) { filestruct *top_save = openfile->fileage; /* Adjust the end point of the marked region for any change in - length of the region's last line. */ + * length of the region's last line. */ if (right_side_up) current_x_save = strlen(openfile->filebot->data); else diff --git a/src/winio.c b/src/winio.c index b6327ee0..afccdbe6 100644 --- a/src/winio.c +++ b/src/winio.c @@ -3059,8 +3059,8 @@ void total_refresh(void) void display_main_list(void) { #ifndef DISABLE_COLOR - if (openfile->syntax - && (openfile->syntax->formatter || openfile->syntax->linter)) + if (openfile->syntax && + (openfile->syntax->formatter || openfile->syntax->linter)) set_lint_or_format_shortcuts(); else set_spell_shortcuts(); @@ -3140,7 +3140,7 @@ void spotlight(bool active, const char *word) { size_t word_len = strlenpt(word), room; - /* Compute the number of columns that are available for the word. */ + /* Compute the number of columns that are available for the word. */ room = COLS + get_page_start(xplustabs()) - xplustabs(); assert(room > 0); -- GitLab