tweaks: normalize some whitespace

master
Benno Schulenberg 2016-05-30 09:09:36 +02:00
parent aaab6e57e0
commit 17cf833b9c
9 changed files with 39 additions and 41 deletions

View File

@ -311,16 +311,14 @@ char *do_browser(char *path)
#endif #endif
if (stat(filelist[selected], &st) == -1) { if (stat(filelist[selected], &st) == -1) {
/* We can't open this file for some reason. /* We can't open this file for some reason. Complain. */
* Complain. */ statusline(ALERT, _("Error reading %s: %s"),
statusline(ALERT, _("Error reading %s: %s"),
filelist[selected], strerror(errno)); filelist[selected], strerror(errno));
continue; continue;
} }
if (!S_ISDIR(st.st_mode)) { if (!S_ISDIR(st.st_mode)) {
/* We've successfully opened a file, we're done, so /* We've successfully opened a file, so we're done. */
* get out. */
retval = mallocstrcpy(NULL, filelist[selected]); retval = mallocstrcpy(NULL, filelist[selected]);
break; break;
} }
@ -395,7 +393,7 @@ char *do_browse_from(const char *inpath)
beep(); beep();
napms(1200); napms(1200);
return NULL; return NULL;
} else } else
align(&path); align(&path);
} }
} }

View File

@ -934,9 +934,9 @@ bool has_blank_mbchars(const char *s)
bool is_valid_unicode(wchar_t wc) bool is_valid_unicode(wchar_t wc)
{ {
return ((0 <= wc && wc <= 0xD7FF) || return ((0 <= wc && wc <= 0xD7FF) ||
(0xE000 <= wc && wc <= 0xFDCF) || (0xE000 <= wc && wc <= 0xFDCF) ||
(0xFDF0 <= wc && wc <= 0xFFFD) || (0xFDF0 <= wc && wc <= 0xFFFD) ||
(0xFFFF < wc && wc <= 0x10FFFF && (wc & 0xFFFF) <= 0xFFFD)); (0xFFFF < wc && wc <= 0x10FFFF && (wc & 0xFFFF) <= 0xFFFD));
} }
#endif #endif

View File

@ -288,7 +288,7 @@ int delete_lockfile(const char *lockfilename)
{ {
if (unlink(lockfilename) < 0 && errno != ENOENT) { if (unlink(lockfilename) < 0 && errno != ENOENT) {
statusline(MILD, _("Error deleting lock file %s: %s"), lockfilename, statusline(MILD, _("Error deleting lock file %s: %s"), lockfilename,
strerror(errno)); strerror(errno));
return -1; return -1;
} }
return 1; return 1;
@ -411,7 +411,7 @@ bool open_buffer(const char *filename, bool undoable)
{ {
bool new_buffer = (openfile == NULL bool new_buffer = (openfile == NULL
#ifndef DISABLE_MULTIBUFFER #ifndef DISABLE_MULTIBUFFER
|| ISSET(MULTIBUFFER) || ISSET(MULTIBUFFER)
#endif #endif
); );
/* Whether we load into this buffer or a new one. */ /* Whether we load into this buffer or a new one. */
@ -2261,7 +2261,7 @@ int do_writeout(bool exiting)
const char *formatstr, *backupstr; const char *formatstr, *backupstr;
formatstr = (openfile->fmt == DOS_FILE) ? _(" [DOS Format]") : formatstr = (openfile->fmt == DOS_FILE) ? _(" [DOS Format]") :
(openfile->fmt == MAC_FILE) ? _(" [Mac Format]") : ""; (openfile->fmt == MAC_FILE) ? _(" [Mac Format]") : "";
backupstr = ISSET(BACKUP_FILE) ? _(" [Backup]") : ""; backupstr = ISSET(BACKUP_FILE) ? _(" [Backup]") : "";
@ -2271,13 +2271,13 @@ int do_writeout(bool exiting)
* the command line. */ * the command line. */
if (openfile->mark_set && !exiting && !ISSET(RESTRICTED)) if (openfile->mark_set && !exiting && !ISSET(RESTRICTED))
msg = (append == PREPEND) ? _("Prepend Selection to File") : msg = (append == PREPEND) ? _("Prepend Selection to File") :
(append == APPEND) ? _("Append Selection to File") : (append == APPEND) ? _("Append Selection to File") :
_("Write Selection to File"); _("Write Selection to File");
else else
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
msg = (append == PREPEND) ? _("File Name to Prepend to") : msg = (append == PREPEND) ? _("File Name to Prepend to") :
(append == APPEND) ? _("File Name to Append to") : (append == APPEND) ? _("File Name to Append to") :
_("File Name to Write"); _("File Name to Write");
present_path = mallocstrcpy(present_path, "./"); present_path = mallocstrcpy(present_path, "./");
@ -2987,13 +2987,15 @@ int check_dotnano(void)
if (stat(nanodir, &dirstat) == -1) { if (stat(nanodir, &dirstat) == -1) {
if (mkdir(nanodir, S_IRWXU | S_IRWXG | S_IRWXO) == -1) { if (mkdir(nanodir, S_IRWXU | S_IRWXG | S_IRWXO) == -1) {
history_error(N_("Unable to create directory %s: %s\n" 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)); nanodir, strerror(errno));
ret = 0; ret = 0;
} }
} else if (!S_ISDIR(dirstat.st_mode)) { } else if (!S_ISDIR(dirstat.st_mode)) {
history_error(N_("Path %s is not a directory and needs to be.\n" 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); nanodir);
ret = 0; ret = 0;
} }

View File

@ -446,7 +446,7 @@ void help_init(void)
/* First see how many toggles there are. */ /* First see how many toggles there are. */
for (s = sclist; s != NULL; s = s->next) 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. */ /* Now show them in the original order. */
while (counter < maximum) { while (counter < maximum) {
@ -454,7 +454,7 @@ void help_init(void)
for (s = sclist; s != NULL; s = s->next) for (s = sclist; s != NULL; s = s->next)
if (s->toggle && s->ordinal == counter) { if (s->toggle && s->ordinal == counter) {
ptr += sprintf(ptr, "%s\t\t%s %s\n", (s->menus == MMAIN ? s->keystr : ""), 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) if (s->toggle == NO_COLOR_SYNTAX || s->toggle == TABS_TO_SPACES)
ptr += sprintf(ptr, "\n"); ptr += sprintf(ptr, "\n");
break; break;

View File

@ -530,7 +530,7 @@ openfilestruct *make_new_opennode(void)
void unlink_opennode(openfilestruct *fileptr) void unlink_opennode(openfilestruct *fileptr)
{ {
assert(fileptr != NULL && fileptr->prev != NULL && fileptr->next != NULL && 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->prev->next = fileptr->next;
fileptr->next->prev = fileptr->prev; fileptr->next->prev = fileptr->prev;
@ -1111,9 +1111,8 @@ void do_exit(void)
if (ISSET(TEMP_FILE)) if (ISSET(TEMP_FILE))
no_current_file_name_warning(); no_current_file_name_warning();
i = do_yesno_prompt(FALSE, i = do_yesno_prompt(FALSE, _("Save modified buffer? "
_("Save modified buffer? (Answering \"No\" will" "(Answering \"No\" will DISCARD changes.) "));
" DISCARD changes.) "));
} }
#ifdef DEBUG #ifdef DEBUG
@ -1782,8 +1781,8 @@ int do_mouse(void)
if (ISSET(SOFTWRAP)) { if (ISSET(SOFTWRAP)) {
size_t i = 0; size_t i = 0;
for (openfile->current = openfile->edittop; for (openfile->current = openfile->edittop;
openfile->current->next && i < mouse_y; openfile->current->next && i < mouse_y;
openfile->current = openfile->current->next, i++) { openfile->current = openfile->current->next, i++) {
openfile->current_y = i; openfile->current_y = i;
i += strlenpt(openfile->current->data) / COLS; i += strlenpt(openfile->current->data) / COLS;
} }
@ -1812,10 +1811,10 @@ int do_mouse(void)
{ {
/* Move to where the click occurred. */ /* Move to where the click occurred. */
for (; openfile->current_y < mouse_y && openfile->current != for (; openfile->current_y < mouse_y && openfile->current !=
openfile->filebot; openfile->current_y++) openfile->filebot; openfile->current_y++)
openfile->current = openfile->current->next; openfile->current = openfile->current->next;
for (; openfile->current_y > mouse_y && openfile->current != 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 = openfile->current->prev;
openfile->current_x = actual_x(openfile->current->data, openfile->current_x = actual_x(openfile->current->data,

View File

@ -434,9 +434,9 @@ typedef struct openfilestruct {
#ifndef DISABLE_NANORC #ifndef DISABLE_NANORC
typedef struct rcoption { typedef struct rcoption {
const char *name; const char *name;
/* The name of the rcfile option. */ /* The name of the rcfile option. */
long flag; long flag;
/* The flag associated with it, if any. */ /* The flag associated with it, if any. */
} rcoption; } rcoption;
#endif #endif

View File

@ -619,7 +619,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
#endif #endif
if (allow_tabs) if (allow_tabs)
answer = input_tab(answer, allow_files, &statusbar_x, answer = input_tab(answer, allow_files, &statusbar_x,
&tabbed, refresh_func, listed); &tabbed, refresh_func, listed);
update_the_statusbar(); update_the_statusbar();
} else } else

View File

@ -220,13 +220,13 @@ void do_cutword(bool backward)
/* Delete a word leftward. */ /* Delete a word leftward. */
void do_cut_prev_word(void) void do_cut_prev_word(void)
{ {
do_cutword(TRUE); do_cutword(TRUE);
} }
/* Delete a word rightward. */ /* Delete a word rightward. */
void do_cut_next_word(void) void do_cut_next_word(void)
{ {
do_cutword(FALSE); do_cutword(FALSE);
} }
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
@ -2519,7 +2519,7 @@ void do_justify(bool full_justify)
if (func == do_uncut_text if (func == do_uncut_text
#ifndef NANO_TINY #ifndef NANO_TINY
|| func == do_undo || func == do_undo
#endif #endif
) { ) {
/* Splice the justify buffer back into the file, but only if we /* 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 #endif
/* Replace the text of the current buffer with the spell-checked /* Replace the text of the current buffer with the spell-checked text. */
* text. */
replace_buffer(tempfile_name); replace_buffer(tempfile_name);
#ifndef NANO_TINY #ifndef NANO_TINY
if (old_mark_set) { if (old_mark_set) {
filestruct *top_save = openfile->fileage; filestruct *top_save = openfile->fileage;
/* Adjust the end point of the marked region for any change in /* 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) if (right_side_up)
current_x_save = strlen(openfile->filebot->data); current_x_save = strlen(openfile->filebot->data);
else else

View File

@ -3059,8 +3059,8 @@ void total_refresh(void)
void display_main_list(void) void display_main_list(void)
{ {
#ifndef DISABLE_COLOR #ifndef DISABLE_COLOR
if (openfile->syntax if (openfile->syntax &&
&& (openfile->syntax->formatter || openfile->syntax->linter)) (openfile->syntax->formatter || openfile->syntax->linter))
set_lint_or_format_shortcuts(); set_lint_or_format_shortcuts();
else else
set_spell_shortcuts(); set_spell_shortcuts();
@ -3140,7 +3140,7 @@ void spotlight(bool active, const char *word)
{ {
size_t word_len = strlenpt(word), room; 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(); room = COLS + get_page_start(xplustabs()) - xplustabs();
assert(room > 0); assert(room > 0);