From 6af5bdea2731fa492065cc2eabdbbad77e45cf6d Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 9 Jun 2014 20:41:15 +0000 Subject: [PATCH] A few more cosmetic tweaks and type fixes. Patch by David Lawrence Ramsey. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4952 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/global.c | 4 ++-- src/nano.c | 5 +++-- src/winio.c | 11 +++++------ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4a5f5310..0d30a248 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 * src/nano.c (do_input): Remove two superfluous false conditions. diff --git a/src/global.c b/src/global.c index 042d5821..c13f7462 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 38d2b90c..5d076fff 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 c84b3eb2..439d15de 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; -- 2.39.5