Several random whitespace and comment tweaks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4874 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
678b221c36
commit
71c9a5245a
|
@ -4,6 +4,7 @@
|
|||
* doc/syntax/nanorc.nanorc: Show key names like M-6 and M-/ as valid.
|
||||
* src/global.c (thanks_for_all_the_fish): Upon exit also free the
|
||||
lists with functions and shortcuts.
|
||||
* src/*.c: Several random whitespace and comment tweaks.
|
||||
|
||||
2014-05-12 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_spell): Provide startup feedback, as for the linter.
|
||||
|
|
22
src/files.c
22
src/files.c
|
@ -508,7 +508,6 @@ int is_file_writable(const char *filename)
|
|||
char *full_filename;
|
||||
bool ans = TRUE;
|
||||
|
||||
|
||||
if (ISSET(VIEW_MODE))
|
||||
return TRUE;
|
||||
|
||||
|
@ -518,7 +517,7 @@ int is_file_writable(const char *filename)
|
|||
full_filename = get_full_path(filename);
|
||||
|
||||
/* Okay, if we can't stat the path due to a component's
|
||||
permissions, just try the relative one */
|
||||
permissions, just try the relative one. */
|
||||
if (full_filename == NULL
|
||||
|| (stat(full_filename, &fileinfo) == -1 && stat(filename, &fileinfo2) != -1))
|
||||
full_filename = mallocstrcpy(NULL, filename);
|
||||
|
@ -891,7 +890,7 @@ int open_file(const char *filename, bool newfie, FILE **f)
|
|||
full_filename = get_full_path(filename);
|
||||
|
||||
/* Okay, if we can't stat the path due to a component's
|
||||
permissions, just try the relative one */
|
||||
permissions, just try the relative one. */
|
||||
if (full_filename == NULL
|
||||
|| (stat(full_filename, &fileinfo) == -1 && stat(filename, &fileinfo2) != -1))
|
||||
full_filename = mallocstrcpy(NULL, filename);
|
||||
|
@ -1280,7 +1279,6 @@ void do_insertfile(
|
|||
* allow inserting a file into a new buffer. */
|
||||
void do_insertfile_void(void)
|
||||
{
|
||||
|
||||
if (ISSET(RESTRICTED)) {
|
||||
nano_disabled_msg();
|
||||
return;
|
||||
|
@ -1314,7 +1312,7 @@ char *get_full_path(const char *origpath)
|
|||
bool path_only;
|
||||
|
||||
if (origpath == NULL)
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
/* Get the current directory. If it doesn't exist, back up and try
|
||||
* again until we get a directory that does, and use that as the
|
||||
|
@ -1731,15 +1729,14 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
/* Save the state of the file at the end of the symlink (if there is
|
||||
* one). */
|
||||
/* Check whether the file (at the end of the symlink) exists. */
|
||||
realexists = (stat(realname, &st) != -1);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* if we have not stat()d this file before (say, the user just
|
||||
* specified it interactively), stat and save the value
|
||||
* or else we will chase null pointers when we do
|
||||
* modtime checks, preserve file times, etc. during backup */
|
||||
/* If we haven't stat()d this file before (say, the user just
|
||||
* specified it interactively), stat and save the value now,
|
||||
* or else we will chase null pointers when we do modtime checks,
|
||||
* preserve file times, and so on, during backup. */
|
||||
if (openfile->current_stat == NULL && !tmp && realexists) {
|
||||
openfile->current_stat = (struct stat *)nmalloc(sizeof(struct stat));
|
||||
stat(realname, openfile->current_stat);
|
||||
|
@ -2912,7 +2909,6 @@ char *construct_filename(const char *str)
|
|||
}
|
||||
|
||||
return newstr;
|
||||
|
||||
}
|
||||
|
||||
char *histfilename(void)
|
||||
|
@ -3197,7 +3193,7 @@ void load_poshistory(void)
|
|||
ssize_t read, lineno, xno;
|
||||
poshiststruct *posptr;
|
||||
|
||||
/* See if we can find the file we're currently editing */
|
||||
/* See if we can find the file we're currently editing. */
|
||||
while ((read = getline(&line, &buf_len, hist)) >= 0) {
|
||||
if (read > 0 && line[read - 1] == '\n') {
|
||||
read--;
|
||||
|
|
|
@ -118,7 +118,7 @@ size_t quotelen;
|
|||
#endif
|
||||
|
||||
bool nodelay_mode = FALSE;
|
||||
/* Are we in nodelay mode (checking for a cancel wile doing something */
|
||||
/* Are we checking for a cancel wile doing something? */
|
||||
|
||||
char *answer = NULL;
|
||||
/* The answer string used by the statusbar prompt. */
|
||||
|
@ -132,9 +132,9 @@ char *backup_dir = NULL;
|
|||
/* The directory where we store backup files. */
|
||||
|
||||
const char *locking_prefix = ".";
|
||||
/* Prefix of how to store the vim-style lock file */
|
||||
/* Prefix of how to store the vim-style lock file. */
|
||||
const char *locking_suffix = ".swp";
|
||||
/* Suffix of the vim-style lock file */
|
||||
/* Suffix of the vim-style lock file. */
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
char *operating_dir = NULL;
|
||||
|
|
16
src/help.c
16
src/help.c
|
@ -376,23 +376,23 @@ void help_init(void)
|
|||
if (htx[2] != NULL)
|
||||
allocsize += strlen(htx[2]);
|
||||
|
||||
/* Count the shortcut help text. Each entry has up to three keys,
|
||||
* which fill 24 columns, plus translated text, plus one or two
|
||||
* \n's. */
|
||||
/* Calculate the length of the shortcut help text. Each entry has
|
||||
* one or two keys, which fill 16 columns, plus translated text,
|
||||
* plus one or two \n's. */
|
||||
for (f = allfuncs; f != NULL; f = f->next)
|
||||
if (f->menus & currmenu)
|
||||
allocsize += (24 * mb_cur_max()) + strlen(f->help) + 2;
|
||||
allocsize += (16 * mb_cur_max()) + strlen(f->help) + 2;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If we're on the main list, we also count the toggle help text.
|
||||
* Each entry has "M-%c\t\t\t", which fills 24 columns, plus a
|
||||
* space, plus translated text, plus one or two '\n's. */
|
||||
* Each entry has "M-%c\t\t", five chars which fill 16 columns,
|
||||
* plus a space, plus translated text, plus one or two '\n's. */
|
||||
if (currmenu == MMAIN) {
|
||||
size_t endis_len = strlen(_("enable/disable"));
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if (s->scfunc == do_toggle_void)
|
||||
allocsize += strlen(_(flagtostr(s->toggle))) + endis_len + 9;
|
||||
allocsize += strlen(_(flagtostr(s->toggle))) + endis_len + 8;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -474,7 +474,7 @@ void help_init(void)
|
|||
if (old_whitespace)
|
||||
SET(WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
#endif
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* If all went well, we didn't overwrite the allocated space for
|
||||
* help_text. */
|
||||
|
|
|
@ -2667,7 +2667,7 @@ int main(int argc, char **argv)
|
|||
interface_color_pair[TITLE_BAR].bright = FALSE;
|
||||
interface_color_pair[STATUS_BAR].bright = FALSE;
|
||||
interface_color_pair[KEY_COMBO].bright = FALSE;
|
||||
interface_color_pair[FUNCTION_TAG].bright = FALSE;
|
||||
interface_color_pair[FUNCTION_TAG].bright = FALSE;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -845,7 +845,7 @@ void parse_header_exp(char *ptr)
|
|||
|
||||
newheader = (regexlisttype *)nmalloc(sizeof(regexlisttype));
|
||||
|
||||
/* Save the regex string if it's valid */
|
||||
/* Save the regex string if it's valid. */
|
||||
if (nregcomp(regexstring, 0)) {
|
||||
newheader->ext_regex = mallocstrcpy(NULL, regexstring);
|
||||
newheader->ext = NULL;
|
||||
|
|
|
@ -381,7 +381,6 @@ void undo_cut(undo *u)
|
|||
copy_from_filestruct(cutbuffer);
|
||||
free_filestruct(cutbuffer);
|
||||
cutbuffer = NULL;
|
||||
|
||||
}
|
||||
|
||||
/* Redo a cut, or undo an uncut. */
|
||||
|
@ -2984,7 +2983,7 @@ void do_spell(void)
|
|||
#endif /* !DISABLE_SPELLER */
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
/* Cleanup things to do after leaving the linter */
|
||||
/* Cleanup things to do after leaving the linter. */
|
||||
void lint_cleanup(void)
|
||||
{
|
||||
currmenu = MMAIN;
|
||||
|
|
|
@ -630,7 +630,7 @@ size_t get_totsize(const filestruct *begin, const filestruct *end)
|
|||
return totsize;
|
||||
}
|
||||
|
||||
/* Get back a pointer given a line number in the current openfilestruct */
|
||||
/* Get back a pointer given a line number in the current openfilestruct. */
|
||||
filestruct *fsfromline(ssize_t lineno)
|
||||
{
|
||||
filestruct *f = openfile->current;
|
||||
|
|
24
src/winio.c
24
src/winio.c
|
@ -311,7 +311,8 @@ int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
|||
|
||||
/* Read in a character and interpret it. Continue doing this until
|
||||
* we get a recognized value or sequence. */
|
||||
while ((kbinput = parse_kbinput(win, meta_key, func_key)) == ERR);
|
||||
while ((kbinput = parse_kbinput(win, meta_key, func_key)) == ERR)
|
||||
;
|
||||
|
||||
/* If we read from the edit window, blank the statusbar if we need
|
||||
* to. */
|
||||
|
@ -339,7 +340,8 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
|||
if (kbinput == 0)
|
||||
return 0;
|
||||
} else
|
||||
while ((kbinput = get_input(win, 1)) == NULL);
|
||||
while ((kbinput = get_input(win, 1)) == NULL)
|
||||
;
|
||||
|
||||
switch (*kbinput) {
|
||||
case ERR:
|
||||
|
@ -1529,7 +1531,8 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
|
|||
int *kbinput, *retval;
|
||||
|
||||
/* Read in the first keystroke. */
|
||||
while ((kbinput = get_input(win, 1)) == NULL);
|
||||
while ((kbinput = get_input(win, 1)) == NULL)
|
||||
;
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (using_utf8()) {
|
||||
|
@ -1555,8 +1558,8 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
|
|||
statusbar(_("Unicode Input"));
|
||||
|
||||
while (uni == ERR) {
|
||||
while ((kbinput = get_input(win, 1)) == NULL);
|
||||
|
||||
while ((kbinput = get_input(win, 1)) == NULL)
|
||||
;
|
||||
uni = get_unicode_kbinput(*kbinput);
|
||||
}
|
||||
|
||||
|
@ -2896,10 +2899,10 @@ int update_line(filestruct *fileptr, size_t index)
|
|||
#ifdef DEBUG
|
||||
fprintf(stderr, "update_line(): Softwrap code, moving to %d index %lu\n", line, (unsigned long) index);
|
||||
#endif
|
||||
blank_line(edit, line, 0, COLS);
|
||||
blank_line(edit, line, 0, COLS);
|
||||
|
||||
/* Expand the line, replacing tabs with spaces, and control
|
||||
* characters with their displayed forms. */
|
||||
* characters with their displayed forms. */
|
||||
converted = display_string(fileptr->data, index, COLS, !ISSET(SOFTWRAP));
|
||||
#ifdef DEBUG
|
||||
if (ISSET(SOFTWRAP) && strlen(converted) >= COLS - 2)
|
||||
|
@ -2908,7 +2911,7 @@ int update_line(filestruct *fileptr, size_t index)
|
|||
|
||||
/* Paint the line. */
|
||||
edit_draw(fileptr, converted, line, index);
|
||||
free(converted);
|
||||
free(converted);
|
||||
extralinesused++;
|
||||
}
|
||||
}
|
||||
|
@ -3096,10 +3099,9 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
|
|||
maxrows || openfile->current->lineno <
|
||||
openfile->edittop->lineno || openfile->current->lineno >=
|
||||
openfile->edittop->lineno + maxrows) {
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "edit_redraw(): line %d was offscreen, oldcurrent = %d edittop = %d",
|
||||
openfile->current->lineno, old_current->lineno, openfile->edittop->lineno);
|
||||
fprintf(stderr, "edit_redraw(): line %d was offscreen, oldcurrent = %d edittop = %d",
|
||||
openfile->current->lineno, old_current->lineno, openfile->edittop->lineno);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
|
|
Loading…
Reference in New Issue