Miscellaneous whitespace adjustments and comment tweaks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4995 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
unneeded extern, and regroup some stuff.
|
||||
* src/files.c (check_dotnano): Wrap long lines and actually report
|
||||
the name that is not a directory.
|
||||
* src/*: Miscellaneous whitespace adjustments and comment tweaks.
|
||||
|
||||
2014-06-19 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/nano.c (window_init): Rename 'no_more_space()' to 'more_space()'
|
||||
|
||||
@@ -177,24 +177,21 @@ char *do_browser(char *path, DIR *dir)
|
||||
#else
|
||||
nano_disabled_msg();
|
||||
#endif
|
||||
/* Search for a filename. */
|
||||
} else if (f->scfunc == do_search) {
|
||||
/* Search for a filename. */
|
||||
curs_set(1);
|
||||
do_filesearch();
|
||||
curs_set(0);
|
||||
/* Search for another filename. */
|
||||
} else if (f->scfunc == do_research) {
|
||||
/* Search for another filename. */
|
||||
do_fileresearch();
|
||||
} else if (f->scfunc == do_page_up) {
|
||||
if (selected >= (editwinrows + fileline % editwinrows) *
|
||||
width)
|
||||
selected -= (editwinrows + fileline % editwinrows) *
|
||||
width;
|
||||
if (selected >= (editwinrows + fileline % editwinrows) * width)
|
||||
selected -= (editwinrows + fileline % editwinrows) * width;
|
||||
else
|
||||
selected = 0;
|
||||
} else if (f->scfunc == do_page_down) {
|
||||
selected += (editwinrows - fileline % editwinrows) *
|
||||
width;
|
||||
selected += (editwinrows - fileline % editwinrows) * width;
|
||||
if (selected > filelist_len - 1)
|
||||
selected = filelist_len - 1;
|
||||
} else if (f->scfunc == do_first_file) {
|
||||
@@ -203,10 +200,9 @@ char *do_browser(char *path, DIR *dir)
|
||||
} else if (f->scfunc == do_last_file) {
|
||||
if (meta_key)
|
||||
selected = filelist_len - 1;
|
||||
/* Go to a specific directory. */
|
||||
} else if (f->scfunc == goto_dir_void) {
|
||||
/* Go to a specific directory. */
|
||||
curs_set(1);
|
||||
|
||||
i = do_prompt(TRUE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
FALSE,
|
||||
@@ -262,8 +258,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (check_operating_dir(new_path, FALSE)) {
|
||||
statusbar(
|
||||
_("Can't go outside of %s in restricted mode"),
|
||||
statusbar(_("Can't go outside of %s in restricted mode"),
|
||||
operating_dir);
|
||||
free(new_path);
|
||||
continue;
|
||||
@@ -310,8 +305,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
* directory if it's ".." or if it's a symlink to a
|
||||
* directory outside the operating directory. */
|
||||
if (check_operating_dir(filelist[selected], FALSE)) {
|
||||
statusbar(
|
||||
_("Can't go outside of %s in restricted mode"),
|
||||
statusbar(_("Can't go outside of %s in restricted mode"),
|
||||
operating_dir);
|
||||
beep();
|
||||
continue;
|
||||
@@ -335,10 +329,9 @@ char *do_browser(char *path, DIR *dir)
|
||||
continue;
|
||||
/* If we've successfully opened a directory, and it's
|
||||
* "..", 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)
|
||||
prev_dir = mallocstrcpy(NULL,
|
||||
striponedir(filelist[selected]));
|
||||
prev_dir = mallocstrcpy(NULL, striponedir(filelist[selected]));
|
||||
|
||||
dir = opendir(filelist[selected]);
|
||||
if (dir == NULL) {
|
||||
@@ -354,8 +347,8 @@ char *do_browser(char *path, DIR *dir)
|
||||
|
||||
/* Start over again with the new path value. */
|
||||
goto change_browser_directory;
|
||||
/* Abort the file browser. */
|
||||
} else if (f->scfunc == do_exit) {
|
||||
/* Abort the file browser. */
|
||||
abort = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
13
src/files.c
13
src/files.c
@@ -2410,8 +2410,10 @@ bool do_writeout(bool exiting)
|
||||
/* Complain if the file exists, the name hasn't changed,
|
||||
* and the stat information we had before does not match
|
||||
* what we have now. */
|
||||
else if (name_exists && openfile->current_stat && (openfile->current_stat->st_mtime < st.st_mtime ||
|
||||
openfile->current_stat->st_dev != st.st_dev || openfile->current_stat->st_ino != st.st_ino)) {
|
||||
else if (name_exists && openfile->current_stat &&
|
||||
(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,
|
||||
_("File was modified since you opened it, continue saving ? "));
|
||||
if (i == 0 || i == -1)
|
||||
@@ -3197,15 +3199,15 @@ void load_poshistory(void)
|
||||
ssize_t read, lineno, xno;
|
||||
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) {
|
||||
if (read > 0 && line[read - 1] == '\n') {
|
||||
read--;
|
||||
line[read] = '\0';
|
||||
}
|
||||
if (read > 0) {
|
||||
if (read > 0)
|
||||
unsunder(line, read);
|
||||
}
|
||||
lineptr = parse_next_word(line);
|
||||
xptr = parse_next_word(lineptr);
|
||||
lineno = atoi(lineptr);
|
||||
@@ -3225,7 +3227,6 @@ void load_poshistory(void)
|
||||
posptr->next->xno = xno;
|
||||
posptr->next->next = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fclose(hist);
|
||||
|
||||
12
src/global.c
12
src/global.c
@@ -377,10 +377,9 @@ void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void))
|
||||
sc *s;
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if (s->scfunc == oldfunc) {
|
||||
if (s->scfunc == oldfunc)
|
||||
s->scfunc = newfunc;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the given menu's first shortcut sequence, or the default value
|
||||
* (2nd arg). Assumes currmenu for the menu to check. */
|
||||
@@ -1326,18 +1325,19 @@ sc *strtosc(char *input)
|
||||
s->scfunc = do_wordlinechar_count;
|
||||
else if (!strcasecmp(input, "undo"))
|
||||
s->scfunc = do_undo;
|
||||
else if (!strcasecmp(input, "redo"))
|
||||
else if (!strcasecmp(input, "redo")) {
|
||||
s->scfunc = do_redo;
|
||||
#endif
|
||||
#ifndef DISABLE_HISTORIES
|
||||
else if (!strcasecmp(input, "prevhistory")) {
|
||||
} else if (!strcasecmp(input, "prevhistory")) {
|
||||
s->scfunc = get_history_older_void;
|
||||
s->execute = FALSE;
|
||||
} else if (!strcasecmp(input, "nexthistory")) {
|
||||
s->scfunc = get_history_newer_void;
|
||||
s->execute = FALSE;
|
||||
}
|
||||
#endif
|
||||
else if (!strcasecmp(input, "nohelp")) {
|
||||
#ifndef NANO_TINY
|
||||
} else if (!strcasecmp(input, "nohelp")) {
|
||||
s->scfunc = do_toggle_void;
|
||||
s->execute = FALSE;
|
||||
s->toggle = NO_HELP;
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
#ifdef NEED_XOPEN_SOURCE_EXTENDED
|
||||
#ifndef _XOPEN_SOURCE_EXTENDED
|
||||
#define _XOPEN_SOURCE_EXTENDED 1
|
||||
#endif /* _XOPEN_SOURCE_EXTENDED */
|
||||
#endif /* NEED_XOPEN_SOURCE_EXTENDED */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __TANDEM
|
||||
/* Tandem NonStop Kernel support. */
|
||||
@@ -440,7 +440,6 @@ typedef struct rcoption {
|
||||
long flag;
|
||||
/* The flag associated with it, if any. */
|
||||
} rcoption;
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct sc {
|
||||
|
||||
@@ -79,7 +79,8 @@ extern char *quoteerr;
|
||||
#else
|
||||
extern size_t quotelen;
|
||||
#endif
|
||||
#endif
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
|
||||
extern bool nodelay_mode;
|
||||
extern char *answer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user