diff --git a/ChangeLog b/ChangeLog index 4a5f5310e3a5b32d5ab3169525921be431062f1f..0d30a2483111108220d2dac1bbb0b02facd64fb2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ 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. diff --git a/src/global.c b/src/global.c index 042d58211fff768f814f1d1fc540a40c6ba13264..c13f7462814892de9de1631085b397386f3f2aa3 100644 --- a/src/global.c +++ b/src/global.c @@ -330,7 +330,7 @@ const sc *first_sc_for(int menu, void (*func)(void)) 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; @@ -371,7 +371,7 @@ void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggl 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 } diff --git a/src/nano.c b/src/nano.c index 38d2b90c62a930ea9188ca038ad1b9af46dd58b0..5d076fff15332be8be8a0e95aca9c411de9ee645 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1763,7 +1763,7 @@ int do_mouse(void) #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++) { @@ -1773,7 +1773,8 @@ int do_mouse(void) #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 diff --git a/src/winio.c b/src/winio.c index c84b3eb20659d17ec2361965274a3272fc140311..439d15de70bf5387918245cefeff59e9a0d7be89 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2453,7 +2453,7 @@ void reset_cursor(void) 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) @@ -2868,9 +2868,8 @@ int update_line(filestruct *fileptr, size_t index) 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; @@ -3033,7 +3032,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines) #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) @@ -3287,7 +3286,7 @@ void edit_update(update_type location) } 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;