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.
|
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()'
|
||||||
|
|||||||
@@ -177,24 +177,21 @@ 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) {
|
||||||
|
/* Search for a filename. */
|
||||||
curs_set(1);
|
curs_set(1);
|
||||||
do_filesearch();
|
do_filesearch();
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
/* Search for another filename. */
|
|
||||||
} else if (f->scfunc == do_research) {
|
} else if (f->scfunc == do_research) {
|
||||||
|
/* Search for another filename. */
|
||||||
do_fileresearch();
|
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) *
|
|
||||||
width;
|
|
||||||
else
|
else
|
||||||
selected = 0;
|
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) {
|
||||||
@@ -203,10 +200,9 @@ char *do_browser(char *path, DIR *dir)
|
|||||||
} 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) {
|
||||||
|
/* Go to a specific directory. */
|
||||||
curs_set(1);
|
curs_set(1);
|
||||||
|
|
||||||
i = do_prompt(TRUE,
|
i = do_prompt(TRUE,
|
||||||
#ifndef DISABLE_TABCOMP
|
#ifndef DISABLE_TABCOMP
|
||||||
FALSE,
|
FALSE,
|
||||||
@@ -262,8 +258,7 @@ char *do_browser(char *path, DIR *dir)
|
|||||||
|
|
||||||
#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;
|
||||||
@@ -310,8 +305,7 @@ char *do_browser(char *path, DIR *dir)
|
|||||||
* 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;
|
||||||
@@ -335,10 +329,9 @@ char *do_browser(char *path, DIR *dir)
|
|||||||
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) {
|
||||||
@@ -354,8 +347,8 @@ char *do_browser(char *path, DIR *dir)
|
|||||||
|
|
||||||
/* 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 the file browser. */
|
||||||
abort = TRUE;
|
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,
|
/* 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)
|
||||||
@@ -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)
|
|||||||
posptr->next->xno = xno;
|
posptr->next->xno = xno;
|
||||||
posptr->next->next = NULL;
|
posptr->next->next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(hist);
|
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;
|
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
|
||||||
* (2nd arg). Assumes currmenu for the menu to check. */
|
* (2nd arg). Assumes currmenu for the menu to check. */
|
||||||
@@ -1326,18 +1325,19 @@ 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
|
||||||
|
} else if (!strcasecmp(input, "nohelp")) {
|
||||||
s->scfunc = do_toggle_void;
|
s->scfunc = do_toggle_void;
|
||||||
s->execute = FALSE;
|
s->execute = FALSE;
|
||||||
s->toggle = NO_HELP;
|
s->toggle = NO_HELP;
|
||||||
|
|||||||
@@ -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 {
|
|||||||
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 {
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user