debugging stuff -- line numbers are long, x positions unsigned long.
* src/files.c, src/move.c, src/nano.c, src/text.c, src/winio.c:
Make tiny nano a bit tinier by preening out some soft-wrap stuff.
+ * src/global.c, src/nano.c, src/winio.c: A few more cosmetic tweaks
+ (whitespace, order, braces, parentheses, and a typo) and type fixes.
2014-06-09 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (do_input): Remove two superfluous false conditions.
return s;
#ifdef DEBUG
- fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long) func, menu);
+ fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu);
#endif
/* Otherwise... */
return NULL;
assign_keyinfo(s);
#ifdef DEBUG
- fprintf(stderr, "Setting sequence to %d for shortcut \"%s\" in menu %x\n", s->seq, scstring, (int) s->menu);
+ fprintf(stderr, "Setting sequence to %d for shortcut \"%s\" in menu %x\n", s->seq, scstring, (int)s->menu);
#endif
}
#ifndef NANO_TINY
if (ISSET(SOFTWRAP)) {
- int i = 0;
+ size_t i = 0;
for (openfile->current = openfile->edittop;
openfile->current->next && i < mouse_y;
openfile->current = openfile->current->next, i++) {
#endif
#ifdef DEBUG
- fprintf(stderr, "do_mouse(): moving to current_y = %d, i %d\n", openfile->current_y, i);
+ fprintf(stderr, "do_mouse(): moving to current_y = %ld, index i = %lu\n",
+ (long)openfile->current_y, (unsigned long)i);
fprintf(stderr, " openfile->current->data = \"%s\"\n", openfile->current->data);
#endif
openfile->current_y = 0;
for (tmp = openfile->edittop; tmp && tmp != openfile->current; tmp = tmp->next)
- openfile->current_y += 1 + strlenpt(tmp->data) / COLS;
+ openfile->current_y += (strlenpt(tmp->data) / COLS) + 1;
openfile->current_y += xplustabs() / COLS;
if (openfile->current_y < editwinrows)
if (ISSET(SOFTWRAP)) {
filestruct *tmp;
- for (tmp = openfile->edittop; tmp && tmp != fileptr; tmp = tmp->next) {
- line += 1 + (strlenpt(tmp->data) / COLS);
- }
+ for (tmp = openfile->edittop; tmp && tmp != fileptr; tmp = tmp->next)
+ line += (strlenpt(tmp->data) / COLS) + 1;
} else
#endif
line = fileptr->lineno - openfile->edittop->lineno;
#ifndef NANO_TINY
/* Don't over-scroll on long lines. */
- if (ISSET(SOFTWRAP) && (direction == UP_DIR)) {
+ if (ISSET(SOFTWRAP) && direction == UP_DIR) {
ssize_t len = strlenpt(openfile->edittop->data) / COLS;
i -= len;
if (len > 0)
}
openfile->edittop = foo;
#ifdef DEBUG
- fprintf(stderr, "edit_udpate(), setting edittop to lineno %ld\n", (long)openfile->edittop->lineno);
+ fprintf(stderr, "edit_update(), setting edittop to lineno %ld\n", (long)openfile->edittop->lineno);
#endif
compute_maxrows();
edit_refresh_needed = TRUE;