nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit bd920b1f4964709f0e0800babb167e5d9a5a82e2
parent 29e094cd21fb2eaae4dde70a4363a9cc33168094
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Fri,  9 Dec 2016 11:36:01 -0600

tweaks: adjust the type of two arguments

Convert digits() to take a ssize_t instead of an int, since it's
used on ssize_t line numbers.  And properly use the long modifier
when displaying a line number.

Also, conditionalize the digits() prototype.

Diffstat:
Msrc/proto.h | 4+++-
Msrc/utils.c | 2+-
Msrc/winio.c | 2+-
3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/proto.h b/src/proto.h @@ -651,7 +651,9 @@ void complete_a_word(void); /* All functions in utils.c. */ void get_homedir(void); -int digits(int n); +#ifdef ENABLE_LINENUMBERS +int digits(ssize_t n); +#endif bool parse_num(const char *str, ssize_t *val); bool parse_line_column(const char *str, ssize_t *line, ssize_t *column); void align(char **str); diff --git a/src/utils.c b/src/utils.c @@ -54,7 +54,7 @@ void get_homedir(void) #ifdef ENABLE_LINENUMBERS /* Return the number of digits that the given integer n takes up. */ -int digits(int n) +int digits(ssize_t n) { if (n < 100000) { if (n < 1000) { diff --git a/src/winio.c b/src/winio.c @@ -2323,7 +2323,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int if (margin > 0) { wattron(edit, interface_color_pair[LINE_NUMBER]); if (last_drawn_line != fileptr->lineno || last_line_y >= line) - mvwprintw(edit, line, 0, "%*i", margin - 1, fileptr->lineno); + mvwprintw(edit, line, 0, "%*ld", margin - 1, (long)fileptr->lineno); else mvwprintw(edit, line, 0, "%*s", margin - 1, " "); wattroff(edit, interface_color_pair[LINE_NUMBER]);