+2014-06-04 David Lawrence Ramsey <pooka109@gmail.com>
+ * src/*.c: Adjustments of whitespace and comments.
+ * doc/nanorc.sample.in: Interpunction tweaks.
+
2014-06-02 Chris Allegretta <chrisa@asty.org>
* doc/syntax/default.nanorc: Can't do trailing spaces in the
default syntax or it will hilight the spaces as you type
## Enable vim-style lock-files. This is just to let a vim user know you
## are editing a file [s]he is trying to edit and vice versa. There are
-## no plans to implement vim-style undo state in these files
+## no plans to implement vim-style undo state in these files.
# set locking
## The opening and closing brackets that can be found by bracket
## Convert typed tabs to spaces.
# set tabstospaces
-## Save automatically on exit, don't prompt.
+## Save automatically on exit; don't prompt.
# set tempfile
## Enable the new (EXPERIMENTAL) generic undo code, not just for line
## Paint the interface elements of nano.
-## This is an example, by default there are no colors.
+## This is an example; by default there are no colors.
# set titlecolor brightwhite,blue
# set statuscolor brightwhite,green
# set keycolor green
kbinput = get_kbinput(edit, &meta_key, &func_key);
#ifndef DISABLE_MOUSE
- if (kbinput == KEY_MOUSE) {
-
+ if (kbinput == KEY_MOUSE) {
int mouse_x, mouse_y;
/* We can click on the edit window to select a
}
/* Didn't find it, make a new node yo! */
- posptr = (poshiststruct *) nmalloc(sizeof(poshiststruct));
+ posptr = (poshiststruct *)nmalloc(sizeof(poshiststruct));
posptr->filename = mallocstrcpy(NULL, fullpath);
posptr->lineno = lineno;
posptr->xno = xpos;
lineno = atoi(lineptr);
xno = atoi(xptr);
if (poshistory == NULL) {
- poshistory = (poshiststruct *) nmalloc(sizeof(poshiststruct));
+ poshistory = (poshiststruct *)nmalloc(sizeof(poshiststruct));
poshistory->filename = mallocstrcpy(NULL, line);
poshistory->lineno = lineno;
poshistory->xno = xno;
} else {
for (posptr = poshistory; posptr->next != NULL; posptr = posptr->next)
;
- posptr->next = (poshiststruct *) nmalloc(sizeof(poshiststruct));
+ posptr->next = (poshiststruct *)nmalloc(sizeof(poshiststruct));
posptr->next->filename = mallocstrcpy(NULL, line);
posptr->next->lineno = lineno;
posptr->next->xno = xno;
sc *s;
if (sclist == NULL) {
- sclist = (sc *) nmalloc(sizeof(sc));
+ sclist = (sc *)nmalloc(sizeof(sc));
s = sclist;
s->next = NULL;
} else {
if (!no_rcfiles && ISSET(HISTORYLOG))
save_history();
if (!no_rcfiles && ISSET(POS_HISTORY)) {
- update_poshistory(openfile->filename, openfile->current->lineno, xplustabs()+1);
+ update_poshistory(openfile->filename, openfile->current->lineno, xplustabs() + 1);
save_poshistory();
}
#endif
void alloc_multidata_if_needed(filestruct *fileptr)
{
if (!fileptr->multidata)
- fileptr->multidata = (short *) nmalloc(openfile->syntax->nmultis * sizeof(short));
+ fileptr->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short));
}
/* Precalculate the multi-line start and end regex info so we can
#endif
char *char_buf = charalloc(mb_cur_max());
size_t char_buf_len = parse_mbchar(&fs->current->data[u->mark_begin_x], char_buf, NULL);
- u->strdata = addstrings(u->strdata, u->strdata?strlen(u->strdata):0, char_buf, char_buf_len);
+ u->strdata = addstrings(u->strdata, u->strdata ? strlen(u->strdata) : 0, char_buf, char_buf_len);
#ifdef DEBUG
fprintf(stderr, "current undo data now \"%s\"\n", u->strdata);
#endif
case DEL: {
char *char_buf = charalloc(mb_cur_max());
size_t char_buf_len = parse_mbchar(&fs->current->data[fs->current_x], char_buf, NULL);
- if (fs->current_x == u->begin) {
+ if (fs->current_x == u->begin) {
/* They're deleting. */
u->strdata = addstrings(u->strdata, strlen(u->strdata), char_buf, char_buf_len);
u->mark_begin_x = fs->current_x;
- } else if (fs->current_x == u->begin - char_buf_len){
+ } else if (fs->current_x == u->begin - char_buf_len) {
/* They're backspacing. */
u->strdata = addstrings(char_buf, char_buf_len, u->strdata, strlen(u->strdata));
u->begin = fs->current_x;
/* Fix the regex if we're on platforms which require an adjustment
* from GNU-style to BSD-style word boundaries. */
-const char *fixbounds(const char *r) {
+const char *fixbounds(const char *r)
+{
#ifndef GNU_WORDBOUNDS
int i, j = 0;
char *r2 = charalloc(strlen(r) * 5);
#endif
for (i = 0; i < strlen(r); i++) {
- if (r[i] != '\0' && r[i] == '\\' && (r[i+1] == '>' || r[i+1] == '<')) {
- strcpy(&r2[j], "[[:");
- r2[j+3] = r[i+1];
- strcpy(&r2[j+4], ":]]");
- i++;
- j += 6;
- } else
- r2[j] = r[i];
- j++;
+ if (r[i] != '\0' && r[i] == '\\' && (r[i + 1] == '>' || r[i + 1] == '<')) {
+ strcpy(&r2[j], "[[:");
+ r2[j + 3] = r[i + 1];
+ strcpy(&r2[j + 4], ":]]");
+ i++;
+ j += 6;
+ } else
+ r2[j] = r[i];
+ j++;
}
r2[j] = '\0';
r3 = mallocstrcpy(NULL, r2);
break;
case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/
* Linux console/xterm/Terminal;
- * Esc [ 6 ^ == PageDown on Eterm. */
+ * Esc [ 6 ^ == PageDown on Eterm. */
retval = sc_seq_or(do_page_down, 0);
break;
case '7': /* Esc [ 7 ~ == Home on rxvt. */
/* First simply paint the line -- then we'll add colors or the
* marking highlight on just the pieces that need it. */
mvwaddstr(edit, line, 0, converted);
- /* Tell ncurses to really redraw the line without trying to optimize
- for what it thinks is already there, because it gets it wrong in
- the case of a wide character in column zero. See bug #31743. */
+
#ifndef USE_SLANG
+ /* Tell ncurses to really redraw the line without trying to optimize
+ * for what it thinks is already there, because it gets it wrong in
+ * the case of a wide character in column zero. See bug #31743. */
wredrawln(edit, line, 1);
#endif
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) {
const colortype *tmpcolor = openfile->colorstrings;
- /* Set up multi-line color data for this line if it's not yet calculated. */
- if (fileptr->multidata == NULL && openfile->syntax
+ /* Set up multi-line color data for this line if it's not yet
+ * calculated. */
+ if (fileptr->multidata == NULL && openfile->syntax
&& openfile->syntax->nmultis > 0) {
int i;
- fileptr->multidata = (short *) nmalloc(openfile->syntax->nmultis * sizeof(short));
- for (i = 0; i < openfile->syntax->nmultis; i++)
- fileptr->multidata[i] = -1; /* Assume this applies until we know otherwise. */
+ fileptr->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short));
+ for (i = 0; i < openfile->syntax->nmultis; i++)
+ /* Assume this applies until we know otherwise. */
+ fileptr->multidata[i] = -1;
}
for (; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
int x_start;
short md = fileptr->multidata[tmpcolor->id];
if (md == -1)
- fileptr->multidata[tmpcolor->id] = CNONE; /* until we find out otherwise */
+ /* Assume this until we know otherwise. */
+ fileptr->multidata[tmpcolor->id] = CNONE;
else if (md == CNONE)
goto end_of_loop;
else if (md == CWHOLELINE) {