Commit 492e9f60 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

Miscellaneous whitespace adjustments and comment tweaks.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4995 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 231 additions and 236 deletions
+231 -236
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
unneeded extern, and regroup some stuff. unneeded extern, and regroup some stuff.
* src/files.c (check_dotnano): Wrap long lines and actually report * src/files.c (check_dotnano): Wrap long lines and actually report
the name that is not a directory. the name that is not a directory.
* src/*: Miscellaneous whitespace adjustments and comment tweaks.
2014-06-19 Benno Schulenberg <bensberg@justemail.net> 2014-06-19 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (window_init): Rename 'no_more_space()' to 'more_space()' * src/nano.c (window_init): Rename 'no_more_space()' to 'more_space()'
......
...@@ -128,35 +128,35 @@ char *do_browser(char *path, DIR *dir) ...@@ -128,35 +128,35 @@ char *do_browser(char *path, DIR *dir)
#ifndef DISABLE_MOUSE #ifndef DISABLE_MOUSE
if (kbinput == KEY_MOUSE) { if (kbinput == KEY_MOUSE) {
int mouse_x, mouse_y; int mouse_x, mouse_y;
/* We can click on the edit window to select a /* We can click on the edit window to select a
* filename. */ * filename. */
if (get_mouseinput(&mouse_x, &mouse_y, TRUE) == 0 && if (get_mouseinput(&mouse_x, &mouse_y, TRUE) == 0 &&
wmouse_trafo(edit, &mouse_y, &mouse_x, FALSE)) { wmouse_trafo(edit, &mouse_y, &mouse_x, FALSE)) {
/* longest is the width of each column. There /* longest is the width of each column. There
* are two spaces between each column. */ * are two spaces between each column. */
selected = (fileline / editwinrows) * selected = (fileline / editwinrows) *
(editwinrows * width) + (mouse_y * (editwinrows * width) + (mouse_y *
width) + (mouse_x / (longest + 2)); width) + (mouse_x / (longest + 2));
/* If they clicked beyond the end of a row, /* If they clicked beyond the end of a row,
* select the filename at the end of that * select the filename at the end of that
* row. */ * row. */
if (mouse_x > width * (longest + 2)) if (mouse_x > width * (longest + 2))
selected--; selected--;
/* If we're off the screen, select the last /* If we're off the screen, select the last
* filename. */ * filename. */
if (selected > filelist_len - 1) if (selected > filelist_len - 1)
selected = filelist_len - 1; selected = filelist_len - 1;
/* If we selected the same filename as last /* If we selected the same filename as last
* time, put back the Enter key so that it's * time, put back the Enter key so that it's
* read in. */ * read in. */
if (old_selected == selected) if (old_selected == selected)
unget_kbinput(sc_seq_or(do_enter_void, 0), FALSE, FALSE); unget_kbinput(sc_seq_or(do_enter_void, 0), FALSE, FALSE);
} }
} }
#endif /* !DISABLE_MOUSE */ #endif /* !DISABLE_MOUSE */
...@@ -169,7 +169,7 @@ char *do_browser(char *path, DIR *dir) ...@@ -169,7 +169,7 @@ char *do_browser(char *path, DIR *dir)
break; break;
if (f->scfunc == total_refresh) { if (f->scfunc == total_refresh) {
total_redraw(); total_redraw();
} else if (f->scfunc == do_help_void) { } else if (f->scfunc == do_help_void) {
#ifndef DISABLE_HELP #ifndef DISABLE_HELP
do_help_void(); do_help_void();
...@@ -177,37 +177,33 @@ char *do_browser(char *path, DIR *dir) ...@@ -177,37 +177,33 @@ char *do_browser(char *path, DIR *dir)
#else #else
nano_disabled_msg(); nano_disabled_msg();
#endif #endif
/* Search for a filename. */
} else if (f->scfunc == do_search) { } else if (f->scfunc == do_search) {
curs_set(1); /* Search for a filename. */
do_filesearch(); curs_set(1);
curs_set(0); do_filesearch();
/* Search for another filename. */ curs_set(0);
} else if (f->scfunc == do_research) { } else if (f->scfunc == do_research) {
do_fileresearch(); /* Search for another filename. */
do_fileresearch();
} else if (f->scfunc == do_page_up) { } else if (f->scfunc == do_page_up) {
if (selected >= (editwinrows + fileline % editwinrows) * if (selected >= (editwinrows + fileline % editwinrows) * width)
width) selected -= (editwinrows + fileline % editwinrows) * width;
selected -= (editwinrows + fileline % editwinrows) * else
width; selected = 0;
else
selected = 0;
} else if (f->scfunc == do_page_down) { } else if (f->scfunc == do_page_down) {
selected += (editwinrows - fileline % editwinrows) * selected += (editwinrows - fileline % editwinrows) * width;
width; if (selected > filelist_len - 1)
if (selected > filelist_len - 1) selected = filelist_len - 1;
selected = filelist_len - 1;
} else if (f->scfunc == do_first_file) { } else if (f->scfunc == do_first_file) {
if (meta_key) if (meta_key)
selected = 0; selected = 0;
} else if (f->scfunc == do_last_file) { } else if (f->scfunc == do_last_file) {
if (meta_key) if (meta_key)
selected = filelist_len - 1; selected = filelist_len - 1;
/* Go to a specific directory. */
} else if (f->scfunc == goto_dir_void) { } else if (f->scfunc == goto_dir_void) {
curs_set(1); /* Go to a specific directory. */
curs_set(1);
i = do_prompt(TRUE, i = do_prompt(TRUE,
#ifndef DISABLE_TABCOMP #ifndef DISABLE_TABCOMP
FALSE, FALSE,
#endif #endif
...@@ -219,144 +215,141 @@ char *do_browser(char *path, DIR *dir) ...@@ -219,144 +215,141 @@ char *do_browser(char *path, DIR *dir)
/* TRANSLATORS: This is a prompt. */ /* TRANSLATORS: This is a prompt. */
browser_refresh, _("Go To Directory")); browser_refresh, _("Go To Directory"));
curs_set(0); curs_set(0);
#if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE) #if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
currmenu = MBROWSER; currmenu = MBROWSER;
#endif #endif
bottombars(MBROWSER); bottombars(MBROWSER);
/* If the directory begins with a newline (i.e. an /* If the directory begins with a newline (i.e. an
* encoded null), treat it as though it's blank. */ * encoded null), treat it as though it's blank. */
if (i < 0 || *answer == '\n') { if (i < 0 || *answer == '\n') {
/* We canceled. Indicate that on the statusbar, and /* We canceled. Indicate that on the statusbar, and
* blank out ans, since we're done with it. */ * blank out ans, since we're done with it. */
statusbar(_("Cancelled")); statusbar(_("Cancelled"));
ans = mallocstrcpy(ans, "");
continue;
} else if (i != 0) {
/* Put back the "Go to Directory" key and save
* answer in ans, so that the file list is displayed
* again, the prompt is displayed again, and what we
* typed before at the prompt is displayed again. */
unget_kbinput(sc_seq_or(do_gotolinecolumn_void, 0), FALSE, FALSE);
ans = mallocstrcpy(ans, answer);
continue;
}
/* We have a directory. Blank out ans, since we're done
* with it. */
ans = mallocstrcpy(ans, ""); ans = mallocstrcpy(ans, "");
continue;
} else if (i != 0) {
/* Put back the "Go to Directory" key and save
* answer in ans, so that the file list is displayed
* again, the prompt is displayed again, and what we
* typed before at the prompt is displayed again. */
unget_kbinput(sc_seq_or(do_gotolinecolumn_void, 0), FALSE, FALSE);
ans = mallocstrcpy(ans, answer);
continue;
}
/* We have a directory. Blank out ans, since we're done
* with it. */
ans = mallocstrcpy(ans, "");
/* Convert newlines to nulls, just before we go to the /* Convert newlines to nulls, just before we go to the
* directory. */ * directory. */
sunder(answer); sunder(answer);
align(&answer); align(&answer);
new_path = real_dir_from_tilde(answer); new_path = real_dir_from_tilde(answer);
if (new_path[0] != '/') { if (new_path[0] != '/') {
new_path = charealloc(new_path, strlen(path) + new_path = charealloc(new_path, strlen(path) +
strlen(answer) + 1); strlen(answer) + 1);
sprintf(new_path, "%s%s", path, answer); sprintf(new_path, "%s%s", path, answer);
} }
#ifndef DISABLE_OPERATINGDIR #ifndef DISABLE_OPERATINGDIR
if (check_operating_dir(new_path, FALSE)) { if (check_operating_dir(new_path, FALSE)) {
statusbar( statusbar(_("Can't go outside of %s in restricted mode"),
_("Can't go outside of %s in restricted mode"), operating_dir);
operating_dir); free(new_path);
free(new_path); continue;
continue; }
}
#endif #endif
dir = opendir(new_path); dir = opendir(new_path);
if (dir == NULL) { if (dir == NULL) {
/* We can't open this directory for some reason. /* We can't open this directory for some reason.
* Complain. */ * Complain. */
statusbar(_("Error reading %s: %s"), answer, statusbar(_("Error reading %s: %s"), answer,
strerror(errno)); strerror(errno));
beep(); beep();
free(new_path); free(new_path);
continue; continue;
} }
/* Start over again with the new path value. */ /* Start over again with the new path value. */
free(path); free(path);
path = new_path; path = new_path;
goto change_browser_directory; goto change_browser_directory;
} else if (f->scfunc == do_up_void) { } else if (f->scfunc == do_up_void) {
if (selected >= width) if (selected >= width)
selected -= width; selected -= width;
} else if (f->scfunc == do_left) { } else if (f->scfunc == do_left) {
if (selected > 0) if (selected > 0)
selected--; selected--;
} else if (f->scfunc == do_down_void) { } else if (f->scfunc == do_down_void) {
if (selected + width <= filelist_len - 1) if (selected + width <= filelist_len - 1)
selected += width; selected += width;
} else if (f->scfunc == do_right) { } else if (f->scfunc == do_right) {
if (selected < filelist_len - 1) if (selected < filelist_len - 1)
selected++; selected++;
} else if (f->scfunc == do_enter_void) { } else if (f->scfunc == do_enter_void) {
/* We can't move up from "/". */ /* We can't move up from "/". */
if (strcmp(filelist[selected], "/..") == 0) { if (strcmp(filelist[selected], "/..") == 0) {
statusbar(_("Can't move up a directory")); statusbar(_("Can't move up a directory"));
beep(); beep();
continue; continue;
} }
#ifndef DISABLE_OPERATINGDIR #ifndef DISABLE_OPERATINGDIR
/* Note: The selected file can be outside the operating /* Note: The selected file can be outside the operating
* directory if it's ".." or if it's a symlink to a * directory if it's ".." or if it's a symlink to a
* directory outside the operating directory. */ * directory outside the operating directory. */
if (check_operating_dir(filelist[selected], FALSE)) { if (check_operating_dir(filelist[selected], FALSE)) {
statusbar( statusbar(_("Can't go outside of %s in restricted mode"),
_("Can't go outside of %s in restricted mode"), operating_dir);
operating_dir); beep();
beep(); continue;
continue; }
}
#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. */
statusbar(_("Error reading %s: %s"), statusbar(_("Error reading %s: %s"),
filelist[selected], strerror(errno)); filelist[selected], strerror(errno));
beep(); beep();
continue; continue;
} }
/* If we've successfully opened a file, we're done, so /* If we've successfully opened a file, we're done, so
* get out. */ * get out. */
if (!S_ISDIR(st.st_mode)) { if (!S_ISDIR(st.st_mode)) {
retval = mallocstrcpy(NULL, filelist[selected]); retval = mallocstrcpy(NULL, filelist[selected]);
abort = TRUE; abort = TRUE;
continue; continue;
/* If we've successfully opened a directory, and it's /* If we've successfully opened a directory, and it's
* "..", save the current directory in prev_dir, so that * "..", save the current directory in prev_dir, so that
* we can select it later. */ * we can easily return to it by hitting Enter. */
} else if (strcmp(tail(filelist[selected]), "..") == 0) } else if (strcmp(tail(filelist[selected]), "..") == 0)
prev_dir = mallocstrcpy(NULL, prev_dir = mallocstrcpy(NULL, striponedir(filelist[selected]));
striponedir(filelist[selected]));
dir = opendir(filelist[selected]);
dir = opendir(filelist[selected]); if (dir == NULL) {
if (dir == NULL) { /* We can't open this directory for some reason.
/* We can't open this directory for some reason. * Complain. */
* Complain. */ statusbar(_("Error reading %s: %s"),
statusbar(_("Error reading %s: %s"), filelist[selected], strerror(errno));
filelist[selected], strerror(errno)); beep();
beep(); continue;
continue; }
}
path = mallocstrcpy(path, filelist[selected]);
path = mallocstrcpy(path, filelist[selected]);
/* Start over again with the new path value. */
/* Start over again with the new path value. */ goto change_browser_directory;
goto change_browser_directory;
/* Abort the file browser. */
} else if (f->scfunc == do_exit) { } else if (f->scfunc == do_exit) {
abort = TRUE; /* Abort the file browser. */
abort = TRUE;
} }
} }
titlebar(NULL); titlebar(NULL);
......
...@@ -1278,7 +1278,7 @@ void do_insertfile( ...@@ -1278,7 +1278,7 @@ void do_insertfile(
void do_insertfile_void(void) void do_insertfile_void(void)
{ {
if (ISSET(RESTRICTED)) { if (ISSET(RESTRICTED)) {
nano_disabled_msg(); nano_disabled_msg();
return; return;
} }
...@@ -2410,8 +2410,10 @@ bool do_writeout(bool exiting) ...@@ -2410,8 +2410,10 @@ bool do_writeout(bool exiting)
/* Complain if the file exists, the name hasn't changed, /* Complain if the file exists, the name hasn't changed,
* and the stat information we had before does not match * and the stat information we had before does not match
* what we have now. */ * what we have now. */
else if (name_exists && openfile->current_stat && (openfile->current_stat->st_mtime < st.st_mtime || else if (name_exists && openfile->current_stat &&
openfile->current_stat->st_dev != st.st_dev || openfile->current_stat->st_ino != st.st_ino)) { (openfile->current_stat->st_mtime < st.st_mtime ||
openfile->current_stat->st_dev != st.st_dev ||
openfile->current_stat->st_ino != st.st_ino)) {
i = do_yesno_prompt(FALSE, i = do_yesno_prompt(FALSE,
_("File was modified since you opened it, continue saving ? ")); _("File was modified since you opened it, continue saving ? "));
if (i == 0 || i == -1) if (i == 0 || i == -1)
...@@ -2931,7 +2933,7 @@ char *poshistfilename(void) ...@@ -2931,7 +2933,7 @@ char *poshistfilename(void)
void history_error(const char *msg, ...) void history_error(const char *msg, ...)
{ {
va_list ap; va_list ap;
va_start(ap, msg); va_start(ap, msg);
vfprintf(stderr, _(msg), ap); vfprintf(stderr, _(msg), ap);
...@@ -3103,7 +3105,7 @@ void save_poshistory(void) ...@@ -3103,7 +3105,7 @@ void save_poshistory(void)
* history file. */ * history file. */
chmod(poshist, S_IRUSR | S_IWUSR); chmod(poshist, S_IRUSR | S_IWUSR);
for (posptr = poshistory; posptr != NULL; posptr = posptr->next) { for (posptr = poshistory; posptr != NULL; posptr = posptr->next) {
statusstr = charalloc(strlen(posptr->filename) + 2 * sizeof(ssize_t) + 4); statusstr = charalloc(strlen(posptr->filename) + 2 * sizeof(ssize_t) + 4);
sprintf(statusstr, "%s %ld %ld\n", posptr->filename, (long)posptr->lineno, sprintf(statusstr, "%s %ld %ld\n", posptr->filename, (long)posptr->lineno,
(long)posptr->xno); (long)posptr->xno);
...@@ -3122,18 +3124,18 @@ void save_poshistory(void) ...@@ -3122,18 +3124,18 @@ void save_poshistory(void)
* and a column. If no entry is found, add a new one at the end. */ * and a column. If no entry is found, add a new one at the end. */
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos) void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
{ {
poshiststruct *posptr, *posprev = NULL; poshiststruct *posptr, *posprev = NULL;
char *fullpath = get_full_path(filename); char *fullpath = get_full_path(filename);
if (fullpath == NULL) if (fullpath == NULL)
return; return;
for (posptr = poshistory; posptr != NULL; posptr = posptr->next) { for (posptr = poshistory; posptr != NULL; posptr = posptr->next) {
if (!strcmp(posptr->filename, fullpath)) { if (!strcmp(posptr->filename, fullpath)) {
posptr->lineno = lineno; posptr->lineno = lineno;
posptr->xno = xpos; posptr->xno = xpos;
return; return;
} }
posprev = posptr; posprev = posptr;
} }
...@@ -3197,15 +3199,15 @@ void load_poshistory(void) ...@@ -3197,15 +3199,15 @@ void load_poshistory(void)
ssize_t read, lineno, xno; ssize_t read, lineno, xno;
poshiststruct *posptr; poshiststruct *posptr;
/* See if we can find the file we're currently editing. */ /* Read and parse each line, and put the data into the
* positions history structure. */
while ((read = getline(&line, &buf_len, hist)) >= 0) { while ((read = getline(&line, &buf_len, hist)) >= 0) {
if (read > 0 && line[read - 1] == '\n') { if (read > 0 && line[read - 1] == '\n') {
read--; read--;
line[read] = '\0'; line[read] = '\0';
} }
if (read > 0) { if (read > 0)
unsunder(line, read); unsunder(line, read);
}
lineptr = parse_next_word(line); lineptr = parse_next_word(line);
xptr = parse_next_word(lineptr); xptr = parse_next_word(lineptr);
lineno = atoi(lineptr); lineno = atoi(lineptr);
...@@ -3225,7 +3227,6 @@ void load_poshistory(void) ...@@ -3225,7 +3227,6 @@ void load_poshistory(void)
posptr->next->xno = xno; posptr->next->xno = xno;
posptr->next->next = NULL; posptr->next->next = NULL;
} }
} }
fclose(hist); fclose(hist);
......
...@@ -377,9 +377,8 @@ void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void)) ...@@ -377,9 +377,8 @@ void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void))
sc *s; sc *s;
for (s = sclist; s != NULL; s = s->next) for (s = sclist; s != NULL; s = s->next)
if (s->scfunc == oldfunc) { if (s->scfunc == oldfunc)
s->scfunc = newfunc; s->scfunc = newfunc;
}
} }
/* Return the given menu's first shortcut sequence, or the default value /* Return the given menu's first shortcut sequence, or the default value
...@@ -1199,7 +1198,7 @@ const subnfunc *sctofunc(sc *s) ...@@ -1199,7 +1198,7 @@ const subnfunc *sctofunc(sc *s)
* for each flag. */ * for each flag. */
const char *flagtostr(int flag) const char *flagtostr(int flag)
{ {
switch (flag) { switch (flag) {
case NO_HELP: case NO_HELP:
/* TRANSLATORS: The next seventeen strings are toggle descriptions; /* TRANSLATORS: The next seventeen strings are toggle descriptions;
* they are best kept shorter than 40 characters, but may be longer. */ * they are best kept shorter than 40 characters, but may be longer. */
...@@ -1326,91 +1325,92 @@ sc *strtosc(char *input) ...@@ -1326,91 +1325,92 @@ sc *strtosc(char *input)
s->scfunc = do_wordlinechar_count; s->scfunc = do_wordlinechar_count;
else if (!strcasecmp(input, "undo")) else if (!strcasecmp(input, "undo"))
s->scfunc = do_undo; s->scfunc = do_undo;
else if (!strcasecmp(input, "redo")) else if (!strcasecmp(input, "redo")) {
s->scfunc = do_redo; s->scfunc = do_redo;
#endif
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
else if (!strcasecmp(input, "prevhistory")) { } else if (!strcasecmp(input, "prevhistory")) {
s->scfunc = get_history_older_void; s->scfunc = get_history_older_void;
s->execute = FALSE; s->execute = FALSE;
} else if (!strcasecmp(input, "nexthistory")) { } else if (!strcasecmp(input, "nexthistory")) {
s->scfunc = get_history_newer_void; s->scfunc = get_history_newer_void;
s->execute = FALSE; s->execute = FALSE;
}
#endif #endif
else if (!strcasecmp(input, "nohelp")) { #ifndef NANO_TINY
s->scfunc = do_toggle_void; } else if (!strcasecmp(input, "nohelp")) {
s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = NO_HELP; s->toggle = NO_HELP;
} else if (!strcasecmp(input, "constupdate")) { } else if (!strcasecmp(input, "constupdate")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = CONST_UPDATE; s->toggle = CONST_UPDATE;
} else if (!strcasecmp(input, "morespace")) { } else if (!strcasecmp(input, "morespace")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = MORE_SPACE; s->toggle = MORE_SPACE;
} else if (!strcasecmp(input, "smoothscroll")) { } else if (!strcasecmp(input, "smoothscroll")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = SMOOTH_SCROLL; s->toggle = SMOOTH_SCROLL;
} else if (!strcasecmp(input, "softwrap")) { } else if (!strcasecmp(input, "softwrap")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = SOFTWRAP; s->toggle = SOFTWRAP;
} else if (!strcasecmp(input, "whitespacedisplay")) { } else if (!strcasecmp(input, "whitespacedisplay")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = WHITESPACE_DISPLAY; s->toggle = WHITESPACE_DISPLAY;
#ifndef DISABLE_COLOR #ifndef DISABLE_COLOR
} else if (!strcasecmp(input, "nosyntax")) { } else if (!strcasecmp(input, "nosyntax")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = NO_COLOR_SYNTAX; s->toggle = NO_COLOR_SYNTAX;
#endif #endif
} else if (!strcasecmp(input, "smarthome")) { } else if (!strcasecmp(input, "smarthome")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = SMART_HOME; s->toggle = SMART_HOME;
} else if (!strcasecmp(input, "autoindent")) { } else if (!strcasecmp(input, "autoindent")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = AUTOINDENT; s->toggle = AUTOINDENT;
} else if (!strcasecmp(input, "cuttoend")) { } else if (!strcasecmp(input, "cuttoend")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = CUT_TO_END; s->toggle = CUT_TO_END;
#ifndef DISABLE_WRAPPING #ifndef DISABLE_WRAPPING
} else if (!strcasecmp(input, "nowrap")) { } else if (!strcasecmp(input, "nowrap")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = NO_WRAP; s->toggle = NO_WRAP;
#endif #endif
} else if (!strcasecmp(input, "tabstospaces")) { } else if (!strcasecmp(input, "tabstospaces")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = TABS_TO_SPACES; s->toggle = TABS_TO_SPACES;
} else if (!strcasecmp(input, "backupfile")) { } else if (!strcasecmp(input, "backupfile")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = BACKUP_FILE; s->toggle = BACKUP_FILE;
#ifndef DISABLE_MULTIBUFFER #ifndef DISABLE_MULTIBUFFER
} else if (!strcasecmp(input, "multibuffer")) { } else if (!strcasecmp(input, "multibuffer")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = MULTIBUFFER; s->toggle = MULTIBUFFER;
#endif #endif
#ifndef DISABLE_MOUSE #ifndef DISABLE_MOUSE
} else if (!strcasecmp(input, "mouse")) { } else if (!strcasecmp(input, "mouse")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = USE_MOUSE; s->toggle = USE_MOUSE;
#endif #endif
} else if (!strcasecmp(input, "noconvert")) { } else if (!strcasecmp(input, "noconvert")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = NO_CONVERT; s->toggle = NO_CONVERT;
} else if (!strcasecmp(input, "suspendenable")) { } else if (!strcasecmp(input, "suspendenable")) {
s->scfunc = do_toggle_void; s->scfunc = do_toggle_void;
s->execute = FALSE; s->execute = FALSE;
s->toggle = SUSPEND; s->toggle = SUSPEND;
} }
...@@ -1489,16 +1489,16 @@ sc *strtosc(char *input) ...@@ -1489,16 +1489,16 @@ sc *strtosc(char *input)
s->scfunc = dos_format_void; s->scfunc = dos_format_void;
s->execute = FALSE; s->execute = FALSE;
} else if (!strcasecmp(input, "macformat")) { } else if (!strcasecmp(input, "macformat")) {
s->scfunc = mac_format_void; s->scfunc = mac_format_void;
s->execute = FALSE; s->execute = FALSE;
} else if (!strcasecmp(input, "append")) { } else if (!strcasecmp(input, "append")) {
s->scfunc = append_void; s->scfunc = append_void;
s->execute = FALSE; s->execute = FALSE;
} else if (!strcasecmp(input, "prepend")) { } else if (!strcasecmp(input, "prepend")) {
s->scfunc = prepend_void; s->scfunc = prepend_void;
s->execute = FALSE; s->execute = FALSE;
} else if (!strcasecmp(input, "backup")) { } else if (!strcasecmp(input, "backup")) {
s->scfunc = backup_file_void; s->scfunc = backup_file_void;
s->execute = FALSE; s->execute = FALSE;
#ifndef ENABLE_TINY #ifndef ENABLE_TINY
} else if (!strcasecmp(input, "flipexecute")) { } else if (!strcasecmp(input, "flipexecute")) {
...@@ -1507,12 +1507,12 @@ sc *strtosc(char *input) ...@@ -1507,12 +1507,12 @@ sc *strtosc(char *input)
#endif #endif
#ifndef DISABLE_MULTIBUFFER #ifndef DISABLE_MULTIBUFFER
} else if (!strcasecmp(input, "newbuffer")) { } else if (!strcasecmp(input, "newbuffer")) {
s->scfunc = new_buffer_void; s->scfunc = new_buffer_void;
s->execute = FALSE; s->execute = FALSE;
#endif #endif
#ifndef DISABLE_BROWSER #ifndef DISABLE_BROWSER
} else if (!strcasecmp(input, "firstfile")) { } else if (!strcasecmp(input, "firstfile")) {
s->scfunc = do_first_file; s->scfunc = do_first_file;
s->execute = FALSE; s->execute = FALSE;
} else if (!strcasecmp(input, "lastfile")) { } else if (!strcasecmp(input, "lastfile")) {
s->scfunc = do_last_file; s->scfunc = do_last_file;
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
#ifdef NEED_XOPEN_SOURCE_EXTENDED #ifdef NEED_XOPEN_SOURCE_EXTENDED
#ifndef _XOPEN_SOURCE_EXTENDED #ifndef _XOPEN_SOURCE_EXTENDED
#define _XOPEN_SOURCE_EXTENDED 1 #define _XOPEN_SOURCE_EXTENDED 1
#endif /* _XOPEN_SOURCE_EXTENDED */ #endif
#endif /* NEED_XOPEN_SOURCE_EXTENDED */ #endif
#ifdef __TANDEM #ifdef __TANDEM
/* Tandem NonStop Kernel support. */ /* Tandem NonStop Kernel support. */
...@@ -440,7 +440,6 @@ typedef struct rcoption { ...@@ -440,7 +440,6 @@ typedef struct rcoption {
long flag; long flag;
/* The flag associated with it, if any. */ /* The flag associated with it, if any. */
} rcoption; } rcoption;
#endif #endif
typedef struct sc { typedef struct sc {
...@@ -568,7 +567,7 @@ enum ...@@ -568,7 +567,7 @@ enum
#ifndef NANO_TINY #ifndef NANO_TINY
/* Extra bits for the undo function. */ /* Extra bits for the undo function. */
#define UNdel_del (1<<0) #define UNdel_del (1<<0)
#define UNdel_backspace (1<<1) #define UNdel_backspace (1<<1)
#define UNcut_marked_backwards (1<<2) #define UNcut_marked_backwards (1<<2)
#define UNcut_cutline (1<<3) #define UNcut_cutline (1<<3)
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
......
...@@ -79,7 +79,8 @@ extern char *quoteerr; ...@@ -79,7 +79,8 @@ extern char *quoteerr;
#else #else
extern size_t quotelen; extern size_t quotelen;
#endif #endif
#endif #endif /* !DISABLE_JUSTIFY */
extern bool nodelay_mode; extern bool nodelay_mode;
extern char *answer; extern char *answer;
......
...@@ -766,8 +766,8 @@ void parse_colors(char *ptr, bool icase) ...@@ -766,8 +766,8 @@ void parse_colors(char *ptr, bool icase)
0)) ? mallocstrcpy(NULL, fgstr) : NULL; 0)) ? mallocstrcpy(NULL, fgstr) : NULL;
/* Lame way to skip another static counter. */ /* Lame way to skip another static counter. */
newcolor->id = endsyntax->nmultis; newcolor->id = endsyntax->nmultis;
endsyntax->nmultis++; endsyntax->nmultis++;
} }
} }
} }
...@@ -970,19 +970,19 @@ static void check_vitals_mapped(void) ...@@ -970,19 +970,19 @@ static void check_vitals_mapped(void)
int inmenus[VITALS] = { MMAIN, MHELP, MWHEREIS, MREPLACE, MGOTOLINE }; int inmenus[VITALS] = { MMAIN, MHELP, MWHEREIS, MREPLACE, MGOTOLINE };
for (v = 0; v < VITALS; v++) { for (v = 0; v < VITALS; v++) {
for (f = allfuncs; f != NULL; f = f->next) { for (f = allfuncs; f != NULL; f = f->next) {
if (f->scfunc == vitals[v] && f->menus & inmenus[v]) { if (f->scfunc == vitals[v] && f->menus & inmenus[v]) {
const sc *s = first_sc_for(inmenus[v], f->scfunc); const sc *s = first_sc_for(inmenus[v], f->scfunc);
if (!s) { if (!s) {
fprintf(stderr, _("Fatal error: no keys mapped for function " fprintf(stderr, _("Fatal error: no keys mapped for function "
"\"%s\". Exiting.\n"), f->desc); "\"%s\". Exiting.\n"), f->desc);
fprintf(stderr, _("If needed, use nano with the -I option " fprintf(stderr, _("If needed, use nano with the -I option "
"to adjust your nanorc settings.\n")); "to adjust your nanorc settings.\n"));
exit(1); exit(1);
} }
break; break;
} }
} }
} }
} }
......
...@@ -3386,14 +3386,14 @@ void do_cursorpos_void(void) ...@@ -3386,14 +3386,14 @@ void do_cursorpos_void(void)
void enable_nodelay(void) void enable_nodelay(void)
{ {
nodelay_mode = TRUE; nodelay_mode = TRUE;
nodelay(edit, TRUE); nodelay(edit, TRUE);
} }
void disable_nodelay(void) void disable_nodelay(void)
{ {
nodelay_mode = FALSE; nodelay_mode = FALSE;
nodelay(edit, FALSE); nodelay(edit, FALSE);
} }
/* Highlight the current word being replaced or spell checked. We /* Highlight the current word being replaced or spell checked. We
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment