'file_bot' from copy_from_filestruct(), and rename the other.
* src/*: Remove the unused parameter 'func_key' from get_shortcut(),
and subsequently from parse_browser_input() and parse_help_input().
+ * src/*: Whitespace adjustments, plus a few comment tweaks.
2014-04-13 Benno Schulenberg <bensberg@justemail.net>
* proto.h, global.c, rcfile.c: Remove the unused parameter 'menu'
if (stat(openfile->filename, &fileinfo) == 0) {
m = magic_open(MAGIC_SYMLINK |
#ifdef DEBUG
- MAGIC_DEBUG | MAGIC_CHECK |
+ MAGIC_DEBUG | MAGIC_CHECK |
#endif
- MAGIC_ERROR);
+ MAGIC_ERROR);
if (m == NULL || magic_load(m, NULL) < 0)
statusbar(_("magic_load() failed: %s"), strerror(errno));
else {
if (magicstring == NULL) {
magicerr = magic_error(m);
statusbar(_("magic_file(%s) failed: %s"), openfile->filename, magicerr);
- }
+ }
#ifdef DEBUG
fprintf(stderr, "magic string returned: %s\n", magicstring);
#endif
/* Figure out where the first begin and end are to determine if
* things changed drastically for the precalculated multi values. */
- nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
- noend = regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
+ nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
+ noend = regexec(tmpcolor->end, fileptr->data, 1, &endmatch, 0);
if (fileptr->multidata[tmpcolor->id] == CWHOLELINE) {
if (nobegin && noend)
continue;
* it. */
size_t cb_save_len = 0;
/* The length of the string at the current end of the cutbuffer,
- * before we add text to it. */
+ * before we add text to it. */
bool old_no_newlines = ISSET(NO_NEWLINES);
#endif
return;
#ifndef NANO_TINY
- update_undo(UNCUT);
+ update_undo(UNCUT);
#endif
/* Add a copy of the text in the cutbuffer to the current filestruct
/* If $TMPDIR is unset, empty, or not a writable directory, and
* full_tempdir is NULL, try P_tmpdir instead. */
- if (full_tempdir == NULL)
+ if (full_tempdir == NULL)
full_tempdir = check_writable_directory(P_tmpdir);
- /* if P_tmpdir is NULL, use /tmp. */
- if (full_tempdir == NULL)
+ /* if P_tmpdir is NULL, use /tmp. */
+ if (full_tempdir == NULL)
full_tempdir = mallocstrcpy(NULL, "/tmp/");
full_tempdir = charealloc(full_tempdir, strlen(full_tempdir) + 12);
/* The line number in help_text of the last help line. This
* variable is zero-based. */
#ifndef DISABLE_MOUSE
- /* The current shortcut list. */
int oldmenu = currmenu;
+ /* The menu we were called from. */
#endif
const char *ptr;
/* The current line of the help text. */
kbinput = get_kbinput(edit, &meta_key, &func_key);
#ifndef DISABLE_MOUSE
- if (kbinput == KEY_MOUSE) {
+ if (kbinput == KEY_MOUSE) {
int mouse_x, mouse_y;
get_mouseinput(&mouse_x, &mouse_y, TRUE);
- continue;
- /* Redraw the screen. */
+ continue; /* Redraw the screen. */
}
#endif
s = get_shortcut(MHELP, &kbinput, &meta_key);
if (!s)
continue;
- f = sctofunc((sc *) s);
+ f = sctofunc((sc *) s);
if (!f)
continue;
* which fill 24 columns, plus translated text, plus one or two
* \n's. */
for (f = allfuncs; f != NULL; f = f->next)
- if (f->menus & currmenu)
+ if (f->menus & currmenu)
allocsize += (24 * mb_cur_max()) + strlen(f->help) + 2;
#ifndef NANO_TINY
size_t endis_len = strlen(_("enable/disable"));
for (s = sclist; s != NULL; s = s->next)
- if (s->scfunc == do_toggle_void)
+ if (s->scfunc == do_toggle_void)
allocsize += strlen(_(flagtostr(s->toggle))) + endis_len + 9;
}
/* Now add our shortcut info. */
for (f = allfuncs; f != NULL; f = f->next) {
- if ((f->menus & currmenu) == 0)
+ if ((f->menus & currmenu) == 0)
continue;
- if (!f->desc || !strcmp(f->desc, ""))
+ if (!f->desc || !strcmp(f->desc, ""))
continue;
- /* Let's just try and use the first 3 shortcuts from the new
- * struct... */
- for (s = sclist, scsfound = 0; s != NULL; s = s->next) {
+ /* Let's just try and use the first 3 shortcuts from the new
+ * struct... */
+ for (s = sclist, scsfound = 0; s != NULL; s = s->next) {
- if (scsfound == 3)
+ if (scsfound == 3)
continue;
- if (s->type == RAWINPUT)
+ if (s->type == RAWINPUT)
continue;
if ((s->menu & currmenu) == 0)
continue;
- if (s->scfunc == f->scfunc) {
+ if (s->scfunc == f->scfunc) {
scsfound++;
if (scsfound == 1)
}
}
/* Pad with tabs if we didn't find 3. */
- for (; scsfound < 3; scsfound++) {
+ for (; scsfound < 3; scsfound++) {
*(ptr++) = '\t';
}
#ifndef NANO_TINY
/* And the toggles... */
if (currmenu == MMAIN)
- for (s = sclist; s != NULL; s = s->next)
- if (s->scfunc == do_toggle_void)
+ for (s = sclist; s != NULL; s = s->next)
+ if (s->scfunc == do_toggle_void)
ptr += sprintf(ptr, "(%s)\t\t\t%s %s\n",
s->keystr, _(flagtostr(s->toggle)), _("enable/disable"));
/* The compiled end (if any) of the regex string. */
struct colortype *next;
/* Next set of colors. */
- int id;
+ int id;
/* Basic id for assigning to lines later. */
} colortype;
blank_statusbar();
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
- wattroff(bottomwin, reverse_attr);
+ wattroff(bottomwin, reverse_attr);
/* Refresh the edit window and the statusbar before getting
* input. */
int i;
for (i = 0; i < BADLISTLEN; i++)
- if (s->type == badtypes[i] && s->seq == badseqs[i])
+ if (s->type == badtypes[i] && s->seq == badseqs[i])
return 1;
return 0;
/* Now find and delete any existing same shortcut in the menu(s). */
for (s = sclist; s != NULL; s = s->next) {
- if (((s->menu & menu)) && !strcmp(s->keystr, keycopy)) {
+ if (((s->menu & menu)) && !strcmp(s->keystr, keycopy)) {
#ifdef DEBUG
fprintf(stderr, "deleting entry from menu %x\n", s->menu);
#endif
/* Look for needle in the current line we're searching. */
enable_nodelay();
while (TRUE) {
- if (time(NULL) - lastkbcheck > 1) {
- lastkbcheck = time(NULL);
+ if (time(NULL) - lastkbcheck > 1) {
+ lastkbcheck = time(NULL);
f = getfuncfromkey(edit);
- if (f && f->scfunc == do_cancel) {
+ if (f && f->scfunc == do_cancel) {
statusbar(_("Cancelled"));
return FALSE;
}
/* We've finished processing the file, so get out. */
if (search_last_line) {
not_found_msg(needle);
- disable_nodelay();
+ disable_nodelay();
return FALSE;
}
#endif
}
} else
- statusbar(_("No current search pattern"));
+ statusbar(_("No current search pattern"));
openfile->placewewant = xplustabs();
edit_redraw(fileptr, pww_save);
u->strdata = f->data;
f->data = data;
break;
-
default:
undidmsg = _("Internal error: unknown type. Please save your work.");
break;
-
}
+
renumber(f);
do_gotolinecolumn(u->lineno, u->begin, FALSE, FALSE, FALSE, TRUE);
statusbar(_("Undid action (%s)"), undidmsg);
default:
undidmsg = _("Internal error: unknown type. Please save your work.");
break;
-
}
+
do_gotolinecolumn(u->lineno, u->begin, FALSE, FALSE, FALSE, TRUE);
statusbar(_("Redid action (%s)"), undidmsg);
openfile->current_undo = u;
openfile->last_action = OTHER;
-
}
#endif /* !NANO_TINY */
{
ssize_t blank_loc = -1;
/* Current tentative return value. Index of the last blank we
- * found with short enough display width. */
+ * found with short enough display width. */
ssize_t cur_loc = 0;
/* Current index in line. */
size_t cur_pos = 0;
REG_NOMATCH);
}
-/* Fix the regex if we're on platforms which requires an adjustment
- * from GNU-style to BSD-style word boundaries. */
+/* Fix the regex if we're on platforms which require an adjustment
+ * from GNU-style to BSD-style word boundaries. */
const char *fixbounds(const char *r) {
#ifndef GNU_WORDBOUNDS
int i, j = 0;
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) {
const colortype *tmpcolor = openfile->colorstrings;
- /* Set up multi-line color data for this line if it's not yet calculated */
+ /* Set up multi-line color data for this line if it's not yet calculated. */
if (fileptr->multidata == NULL && openfile->syntax
&& openfile->syntax->nmultis > 0) {
int i;
fileptr->multidata = (short *) nmalloc(openfile->syntax->nmultis * sizeof(short));
for (i = 0; i < openfile->syntax->nmultis; i++)
- fileptr->multidata[i] = -1; /* Assue this applies until we know otherwise */
+ fileptr->multidata[i] = -1; /* Assume this applies until we know otherwise. */
}
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
int x_start;