1
1

tweaks: fix some whitespace errors, and convert alignment tabs to spaces

Этот коммит содержится в:
Benno Schulenberg 2017-12-29 21:35:14 +01:00
родитель 87206c0607
Коммит 17429d7f38
11 изменённых файлов: 84 добавлений и 85 удалений

Просмотреть файл

@ -216,7 +216,7 @@ char *do_browser(char *path)
selected = filelist_len - 1; selected = filelist_len - 1;
else if (selected + editwinrows * width >= filelist_len) else if (selected + editwinrows * width >= filelist_len)
selected = (selected + editwinrows * width - filelist_len) % selected = (selected + editwinrows * width - filelist_len) %
width + filelist_len - width; width + filelist_len - width;
else else
selected += editwinrows * width; selected += editwinrows * width;
} else if (func == to_first_file) { } else if (func == to_first_file) {

Просмотреть файл

@ -646,7 +646,7 @@ char *revstrpbrk(const char *head, const char *accept, const char *pointer)
{ {
if (*pointer == '\0') { if (*pointer == '\0') {
if (pointer == head) if (pointer == head)
return NULL; return NULL;
pointer--; pointer--;
} }

Просмотреть файл

@ -258,7 +258,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
if (wroteamt < lockdatalen) { if (wroteamt < lockdatalen) {
statusline(MILD, _("Error writing lock file %s: %s"), statusline(MILD, _("Error writing lock file %s: %s"),
lockfilename, ferror(filestream)); lockfilename, ferror(filestream));
fclose(filestream); fclose(filestream);
goto free_the_data; goto free_the_data;
} }
@ -1452,9 +1452,9 @@ bool outside_of_confinement(const char *currpath, bool allow_tabcomp)
int prompt_failed_backupwrite(const char *filename) int prompt_failed_backupwrite(const char *filename)
{ {
static int response; static int response;
static char *prevfile = NULL; /* What was the last file we were static char *prevfile = NULL;
* passed so we don't keep asking /* The last file we were passed, so we don't keep asking this.
* this? Though maybe we should... */ * Though maybe we should? */
if (prevfile == NULL || strcmp(filename, prevfile)) { if (prevfile == NULL || strcmp(filename, prevfile)) {
response = do_yesno_prompt(FALSE, _("Failed to write backup file; " response = do_yesno_prompt(FALSE, _("Failed to write backup file; "
"continue saving? (Say N if unsure.) ")); "continue saving? (Say N if unsure.) "));
@ -1471,7 +1471,7 @@ void init_backup_dir(void)
backup_dir = free_and_assign(backup_dir, get_full_path(backup_dir)); backup_dir = free_and_assign(backup_dir, get_full_path(backup_dir));
/* If we can't get an absolute path (which means it doesn't exist or /* If we can't get an absolute path (which means it doesn't exist or
isn't accessible), or it's not a directory, fail. */ * isn't accessible), or it's not a directory, fail. */
if (backup_dir == NULL || backup_dir[strlen(backup_dir) - 1] != '/') if (backup_dir == NULL || backup_dir[strlen(backup_dir) - 1] != '/')
die(_("Invalid backup directory\n")); die(_("Invalid backup directory\n"));
@ -2224,8 +2224,8 @@ int do_writeout(bool exiting, bool withprompt)
if (ISSET(TEMP_FILE) && withprompt) { if (ISSET(TEMP_FILE) && withprompt) {
free(given); free(given);
if (response == 1) if (response == 1)
return write_file(openfile->filename, return write_file(openfile->filename, NULL,
NULL, FALSE, OVERWRITE, TRUE); FALSE, OVERWRITE, TRUE);
else if (response == 0) else if (response == 0)
return 2; return 2;
else else

Просмотреть файл

@ -261,9 +261,9 @@ size_t length_of_list(int menu)
} }
/* To make the functions and shortcuts lists clearer. */ /* To make the functions and shortcuts lists clearer. */
#define VIEW TRUE /* Is allowed in view mode. */ #define VIEW TRUE /* Is allowed in view mode. */
#define NOVIEW FALSE #define NOVIEW FALSE
#define BLANKAFTER TRUE /* A blank line after this one. */ #define BLANKAFTER TRUE /* A blank line after this one. */
#define TOGETHER FALSE #define TOGETHER FALSE
/* Just throw this here. */ /* Just throw this here. */

Просмотреть файл

@ -84,7 +84,7 @@ void wrap_the_help_text(bool redisplaying)
while (TRUE) { while (TRUE) {
sum += strlen(openfile->current->data); sum += strlen(openfile->current->data);
if (sum > location) if (sum > location)
break; break;
openfile->current = openfile->current->next; openfile->current = openfile->current->next;
} }

Просмотреть файл

@ -328,7 +328,7 @@ void load_history(void)
update_history(history, line); update_history(history, line);
} else if (history == &search_history) } else if (history == &search_history)
history = &replace_history; history = &replace_history;
else else
history = &execute_history; history = &execute_history;
} }

Просмотреть файл

@ -1393,7 +1393,7 @@ void do_toggle(int flag)
refresh_needed = TRUE; refresh_needed = TRUE;
break; break;
case WHITESPACE_DISPLAY: case WHITESPACE_DISPLAY:
titlebar(NULL); /* Fall through. */ titlebar(NULL); /* Fall through. */
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
case NO_COLOR_SYNTAX: case NO_COLOR_SYNTAX:
#endif #endif
@ -1815,7 +1815,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
i += char_len; i += char_len;
/* If controls are not allowed, ignore an ASCII control character. */ /* If controls are not allowed, ignore an ASCII control character. */
if (!allow_cntrls && is_ascii_cntrl_char(*(output + i - char_len))) if (!allow_cntrls && is_ascii_cntrl_char(*(output + i - char_len)))
continue; continue;
/* Make room for the new character and copy it into the line. */ /* Make room for the new character and copy it into the line. */

Просмотреть файл

@ -224,7 +224,7 @@ typedef struct syntaxtype {
char *linter; char *linter;
/* The command with which to lint this type of file. */ /* The command with which to lint this type of file. */
char *formatter; char *formatter;
/* The formatting command (for programming languages mainly). */ /* The formatting command (for programming languages mainly). */
#ifdef ENABLE_COMMENT #ifdef ENABLE_COMMENT
char *comment; char *comment;
/* The line comment prefix (and postfix) for this type of file. */ /* The line comment prefix (and postfix) for this type of file. */
@ -253,17 +253,17 @@ typedef struct lintstruct {
} lintstruct; } lintstruct;
/* Flags that indicate how a multiline regex applies to a line. */ /* Flags that indicate how a multiline regex applies to a line. */
#define CNONE (1<<1) #define CNONE (1<<1)
/* Yay, regex doesn't apply to this line at all! */ /* Yay, regex doesn't apply to this line at all! */
#define CBEGINBEFORE (1<<2) #define CBEGINBEFORE (1<<2)
/* Regex starts on an earlier line, ends on this one. */ /* Regex starts on an earlier line, ends on this one. */
#define CENDAFTER (1<<3) #define CENDAFTER (1<<3)
/* Regex starts on this line and ends on a later one. */ /* Regex starts on this line and ends on a later one. */
#define CWHOLELINE (1<<4) #define CWHOLELINE (1<<4)
/* Whole line engulfed by the regex, start < me, end > me. */ /* Whole line engulfed by the regex, start < me, end > me. */
#define CSTARTENDHERE (1<<5) #define CSTARTENDHERE (1<<5)
/* Regex starts and ends within this line. */ /* Regex starts and ends within this line. */
#define CWOULDBE (1<<6) #define CWOULDBE (1<<6)
/* An unpaired start match on or before this line. */ /* An unpaired start match on or before this line. */
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
@ -534,25 +534,25 @@ enum
}; };
/* Flags for the menus in which a given function should be present. */ /* Flags for the menus in which a given function should be present. */
#define MMAIN (1<<0) #define MMAIN (1<<0)
#define MWHEREIS (1<<1) #define MWHEREIS (1<<1)
#define MREPLACE (1<<2) #define MREPLACE (1<<2)
#define MREPLACEWITH (1<<3) #define MREPLACEWITH (1<<3)
#define MGOTOLINE (1<<4) #define MGOTOLINE (1<<4)
#define MWRITEFILE (1<<5) #define MWRITEFILE (1<<5)
#define MINSERTFILE (1<<6) #define MINSERTFILE (1<<6)
#define MEXTCMD (1<<7) #define MEXTCMD (1<<7)
#define MHELP (1<<8) #define MHELP (1<<8)
#define MSPELL (1<<9) #define MSPELL (1<<9)
#define MBROWSER (1<<10) #define MBROWSER (1<<10)
#define MWHEREISFILE (1<<11) #define MWHEREISFILE (1<<11)
#define MGOTODIR (1<<12) #define MGOTODIR (1<<12)
#define MYESNO (1<<13) #define MYESNO (1<<13)
#define MLINTER (1<<14) #define MLINTER (1<<14)
#define MFINDINHELP (1<<15) #define MFINDINHELP (1<<15)
/* This is an abbreviation for all menus except Help and YesNo. */ /* This is an abbreviation for all menus except Help and YesNo. */
#define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|\ #define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|\
MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MFINDINHELP|MSPELL|MLINTER) MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MFINDINHELP|MSPELL|MLINTER)
#ifndef NANO_TINY #ifndef NANO_TINY
#define MSOME MMOST #define MSOME MMOST
#else #else
@ -605,12 +605,12 @@ enum
#define KEY_WINCH -2 #define KEY_WINCH -2
/* Some extra flags for the undo function. */ /* Some extra flags for the undo function. */
#define WAS_FINAL_BACKSPACE (1<<1) #define WAS_FINAL_BACKSPACE (1<<1)
#define WAS_WHOLE_LINE (1<<2) #define WAS_WHOLE_LINE (1<<2)
#define WAS_FINAL_LINE (1<<3) #define WAS_FINAL_LINE (1<<3)
/* The flags for the mark need to be the highest. */ /* The flags for the mark need to be the highest. */
#define MARK_WAS_SET (1<<4) #define MARK_WAS_SET (1<<4)
#define WAS_MARKED_FORWARD (1<<5) #define WAS_MARKED_FORWARD (1<<5)
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
/* The maximum number of entries displayed in the main shortcut list. */ /* The maximum number of entries displayed in the main shortcut list. */

Просмотреть файл

@ -169,7 +169,7 @@ int search_init(bool replacing, bool use_answer)
if (ISSET(USE_REGEXP) && !regexp_init(last_search)) if (ISSET(USE_REGEXP) && !regexp_init(last_search))
return -1; return -1;
else else
return 0; /* We have a valid string or regex. */ return 0; /* We have a valid string or regex. */
} }
func = func_from_key(&i); func = func_from_key(&i);
@ -188,7 +188,7 @@ int search_init(bool replacing, bool use_answer)
return 1; return 1;
} else if (func == flip_replace) { } else if (func == flip_replace) {
backupstring = mallocstrcpy(backupstring, answer); backupstring = mallocstrcpy(backupstring, answer);
return -2; /* Call the opposite search function. */ return -2; /* Call the opposite search function. */
} else if (func == do_gotolinecolumn_void) { } else if (func == do_gotolinecolumn_void) {
do_gotolinecolumn(openfile->current->lineno, do_gotolinecolumn(openfile->current->lineno,
openfile->placewewant + 1, TRUE, TRUE); openfile->placewewant + 1, TRUE, TRUE);
@ -359,11 +359,11 @@ void do_search(void)
{ {
int i = search_init(FALSE, FALSE); int i = search_init(FALSE, FALSE);
if (i == -1) /* Cancelled, or some other exit reason. */ if (i == -1) /* Cancelled, or some other exit reason. */
search_replace_abort(); search_replace_abort();
else if (i == -2) /* Do a replace instead. */ else if (i == -2) /* Do a replace instead. */
do_replace(); do_replace();
else if (i == 1) /* Toggled something. */ else if (i == 1) /* Toggled something. */
do_search(); do_search();
if (i == 0) if (i == 0)
@ -732,11 +732,11 @@ void do_replace(void)
i = search_init(TRUE, FALSE); i = search_init(TRUE, FALSE);
if (i == -1) /* Cancelled, or some other exit reason. */ if (i == -1) /* Cancelled, or some other exit reason. */
search_replace_abort(); search_replace_abort();
else if (i == -2) /* Do a search instead. */ else if (i == -2) /* Do a search instead. */
do_search(); do_search();
else if (i == 1) /* Toggled something. */ else if (i == 1) /* Toggled something. */
do_replace(); do_replace();
if (i != 0) if (i != 0)
@ -1048,7 +1048,7 @@ void do_find_bracket(void)
/* If we found an identical bracket, increment count. If we /* If we found an identical bracket, increment count. If we
* found a complementary bracket, decrement it. */ * found a complementary bracket, decrement it. */
count += (strncmp(openfile->current->data + openfile->current_x, count += (strncmp(openfile->current->data + openfile->current_x,
ch, ch_len) == 0) ? 1 : -1; ch, ch_len) == 0) ? 1 : -1;
/* If count is zero, we've found a matching bracket. Update /* If count is zero, we've found a matching bracket. Update
* the screen and get out. */ * the screen and get out. */

Просмотреть файл

@ -281,7 +281,7 @@ void indent_a_line(filestruct *line, char *indentation)
/* Compensate for the change in the current line. */ /* Compensate for the change in the current line. */
if (line == openfile->mark && openfile->mark_x > 0) if (line == openfile->mark && openfile->mark_x > 0)
openfile->mark_x += indent_len; openfile->mark_x += indent_len;
if (line == openfile->current && openfile->current_x > 0) { if (line == openfile->current && openfile->current_x > 0) {
openfile->current_x += indent_len; openfile->current_x += indent_len;
openfile->placewewant = xplustabs(); openfile->placewewant = xplustabs();
@ -349,7 +349,7 @@ size_t length_of_white(const char *text)
if (*text != ' ') if (*text != ' ')
return bytes_of_white; return bytes_of_white;
if (++bytes_of_white == tabsize) if (++bytes_of_white == tabsize)
return tabsize; return tabsize;
text++; text++;
@ -1933,14 +1933,14 @@ bool indents_match(const char *a_line, size_t a_indent, const char
* *
* A line is "the beginning of a paragraph" if it is part of a * A line is "the beginning of a paragraph" if it is part of a
* paragraph and * paragraph and
* 1) it is the top line of the file, or * 1) it is the top line of the file, or
* 2) the line above it is not part of a paragraph, or * 2) the line above it is not part of a paragraph, or
* 3) the line above it does not have precisely the same quote * 3) the line above it does not have precisely the same quote
* part, or * part, or
* 4) the indentation of this line is not an initial substring of * 4) the indentation of this line is not an initial substring of
* the indentation of the previous line, or * the indentation of the previous line, or
* 5) this line has no quote part and some indentation, and * 5) this line has no quote part and some indentation, and
* autoindent isn't turned on. * autoindent isn't turned on.
* The reason for number 5) is that if autoindent isn't turned on, * The reason for number 5) is that if autoindent isn't turned on,
* then an indented line is expected to start a paragraph, as in * then an indented line is expected to start a paragraph, as in
* books. Thus, nano can justify an indented paragraph only if * books. Thus, nano can justify an indented paragraph only if
@ -3139,8 +3139,7 @@ void do_linter(void)
* *
* filenameorcategory:line:column:message (e.g. splint) * filenameorcategory:line:column:message (e.g. splint)
* filenameorcategory:line,column:message (e.g. pylint) * filenameorcategory:line,column:message (e.g. pylint)
* filenameorcategory:line:message (e.g. pyflakes) * filenameorcategory:line:message (e.g. pyflakes) */
*/
if (strstr(message, ": ") != NULL) { if (strstr(message, ": ") != NULL) {
filename = strtok(read_buff_word, ":"); filename = strtok(read_buff_word, ":");
if ((linestr = strtok(NULL, ":")) != NULL) { if ((linestr = strtok(NULL, ":")) != NULL) {

Просмотреть файл

@ -671,7 +671,7 @@ int parse_kbinput(WINDOW *win)
/* ncurses and Slang don't support KEY_SUP. */ /* ncurses and Slang don't support KEY_SUP. */
case KEY_SUP: case KEY_SUP:
#endif #endif
case KEY_SR: /* Scroll backward, on Xfce4-terminal. */ case KEY_SR: /* Scroll backward, on Xfce4-terminal. */
shift_held = TRUE; shift_held = TRUE;
return KEY_UP; return KEY_UP;
#endif #endif
@ -680,7 +680,7 @@ int parse_kbinput(WINDOW *win)
/* ncurses and Slang don't support KEY_SDOWN. */ /* ncurses and Slang don't support KEY_SDOWN. */
case KEY_SDOWN: case KEY_SDOWN:
#endif #endif
case KEY_SF: /* Scroll forward, on Xfce4-terminal. */ case KEY_SF: /* Scroll forward, on Xfce4-terminal. */
shift_held = TRUE; shift_held = TRUE;
return KEY_DOWN; return KEY_DOWN;
#endif #endif
@ -690,7 +690,7 @@ int parse_kbinput(WINDOW *win)
#endif #endif
case SHIFT_HOME: case SHIFT_HOME:
shift_held = TRUE; shift_held = TRUE;
case KEY_A1: /* Home (7) on keypad with NumLock off. */ case KEY_A1: /* Home (7) on keypad with NumLock off. */
return KEY_HOME; return KEY_HOME;
#ifdef KEY_SEND #ifdef KEY_SEND
/* HP-UX 10-11 and Slang don't support KEY_SEND. */ /* HP-UX 10-11 and Slang don't support KEY_SEND. */
@ -698,25 +698,25 @@ int parse_kbinput(WINDOW *win)
#endif #endif
case SHIFT_END: case SHIFT_END:
shift_held = TRUE; shift_held = TRUE;
case KEY_C1: /* End (1) on keypad with NumLock off. */ case KEY_C1: /* End (1) on keypad with NumLock off. */
return KEY_END; return KEY_END;
#ifndef NANO_TINY #ifndef NANO_TINY
#ifdef KEY_SPREVIOUS #ifdef KEY_SPREVIOUS
case KEY_SPREVIOUS: case KEY_SPREVIOUS:
#endif #endif
case SHIFT_PAGEUP: /* Fake key, from Shift+Alt+Up. */ case SHIFT_PAGEUP: /* Fake key, from Shift+Alt+Up. */
shift_held = TRUE; shift_held = TRUE;
#endif #endif
case KEY_A3: /* PageUp (9) on keypad with NumLock off. */ case KEY_A3: /* PageUp (9) on keypad with NumLock off. */
return KEY_PPAGE; return KEY_PPAGE;
#ifndef NANO_TINY #ifndef NANO_TINY
#ifdef KEY_SNEXT #ifdef KEY_SNEXT
case KEY_SNEXT: case KEY_SNEXT:
#endif #endif
case SHIFT_PAGEDOWN: /* Fake key, from Shift+Alt+Down. */ case SHIFT_PAGEDOWN: /* Fake key, from Shift+Alt+Down. */
shift_held = TRUE; shift_held = TRUE;
#endif #endif
case KEY_C3: /* PageDown (3) on keypad with NumLock off. */ case KEY_C3: /* PageDown (3) on keypad with NumLock off. */
return KEY_NPAGE; return KEY_NPAGE;
#ifdef KEY_SDC #ifdef KEY_SDC
/* Slang doesn't support KEY_SDC. */ /* Slang doesn't support KEY_SDC. */
@ -740,7 +740,7 @@ int parse_kbinput(WINDOW *win)
/* Slang doesn't support KEY_BEG. */ /* Slang doesn't support KEY_BEG. */
case KEY_BEG: case KEY_BEG:
#endif #endif
case KEY_B2: /* Center (5) on keypad with NumLock off. */ case KEY_B2: /* Center (5) on keypad with NumLock off. */
return ERR; return ERR;
#ifdef KEY_CANCEL #ifdef KEY_CANCEL
#ifdef KEY_SCANCEL #ifdef KEY_SCANCEL
@ -1975,7 +1975,7 @@ char *display_string(const char *buf, size_t column, size_t span, bool isdata)
/* For invalid codepoints, skip extra bytes. */ /* For invalid codepoints, skip extra bytes. */
if (charlength < -1) if (charlength < -1)
buf += charlength + 7; buf += charlength + 7;
} }
/* If there is more text than can be shown, make room for the $ or >. */ /* If there is more text than can be shown, make room for the $ or >. */
@ -2555,7 +2555,7 @@ void edit_draw(filestruct *fileptr, const char *converted,
* and the current line. But is there an end after the start * and the current line. But is there an end after the start
* at all? We don't paint unterminated starts. */ * at all? We don't paint unterminated starts. */
while (end_line != NULL && regexec(varnish->end, end_line->data, while (end_line != NULL && regexec(varnish->end, end_line->data,
1, &endmatch, 0) == REG_NOMATCH) 1, &endmatch, 0) == REG_NOMATCH)
end_line = end_line->next; end_line = end_line->next;
/* If there is no end, there is nothing to paint. */ /* If there is no end, there is nothing to paint. */
@ -3525,11 +3525,11 @@ void do_credits(void)
bool old_no_help = ISSET(NO_HELP); bool old_no_help = ISSET(NO_HELP);
int kbinput = ERR, crpos = 0, xlpos = 0; int kbinput = ERR, crpos = 0, xlpos = 0;
const char *credits[CREDIT_LEN] = { const char *credits[CREDIT_LEN] = {
NULL, /* "The nano text editor" */ NULL, /* "The nano text editor" */
NULL, /* "version" */ NULL, /* "version" */
VERSION, VERSION,
"", "",
NULL, /* "Brought to you by:" */ NULL, /* "Brought to you by:" */
"Chris Allegretta", "Chris Allegretta",
"Jordi Mallach", "Jordi Mallach",
"Adam Rogoyski", "Adam Rogoyski",
@ -3550,7 +3550,7 @@ void do_credits(void)
"Ryan Krebs", "Ryan Krebs",
"Albert Chin", "Albert Chin",
"", "",
NULL, /* "Special thanks to:" */ NULL, /* "Special thanks to:" */
"Monique, Brielle & Joseph", "Monique, Brielle & Joseph",
"Plattsburgh State University", "Plattsburgh State University",
"Benet Laboratories", "Benet Laboratories",
@ -3558,16 +3558,16 @@ void do_credits(void)
"Linda Young", "Linda Young",
"Jeremy Robichaud", "Jeremy Robichaud",
"Richard Kolb II", "Richard Kolb II",
NULL, /* "The Free Software Foundation" */ NULL, /* "The Free Software Foundation" */
"Linus Torvalds", "Linus Torvalds",
NULL, /* "the many translators and the TP" */ NULL, /* "the many translators and the TP" */
NULL, /* "For ncurses:" */ NULL, /* "For ncurses:" */
"Thomas Dickey", "Thomas Dickey",
"Pavel Curtis", "Pavel Curtis",
"Zeyd Ben-Halim", "Zeyd Ben-Halim",
"Eric S. Raymond", "Eric S. Raymond",
NULL, /* "and anyone else we forgot..." */ NULL, /* "and anyone else we forgot..." */
NULL, /* "Thank you for using nano!" */ NULL, /* "Thank you for using nano!" */
"", "",
"", "",
"", "",