From: David Lawrence Ramsey Date: Sun, 28 Sep 2003 19:15:18 +0000 (+0000) Subject: a few missing minor bits of DB's refactored display code X-Git-Tag: v1.3.0~16 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=5dcba30395e5fe181ecf37659bb1d89b60a8b474;p=nano.git a few missing minor bits of DB's refactored display code git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1559 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 4934b02d..9349ee8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,12 +46,12 @@ CVS code - instead of several; and do some other minor refactoring of related display functions to simplify them. New functions mark_order() and display_string(); changes to actual_x(), - edit_add(), update_line(), statusbar(), and - do_replace_highlight(). (David Benbennick) DLR: Add minor - cosmetic tweaks, add missing NANO_SMALL #ifdef around the text - for a backwards search in the refactored code, and enclose - dump_buffer() and dump_buffer_reverse() in one ENABLE_DEBUG - #ifdef instead of two. + strnlenpt(), blank_bottombars(), edit_add(), update_line(), + statusbar(), and do_replace_highlight(). (David Benbennick) + DLR: Add minor cosmetic tweaks, add missing NANO_SMALL #ifdef + around the text for a backwards search in the refactored code, + and enclose dump_buffer() and dump_buffer_reverse() in one + ENABLE_DEBUG #ifdef instead of two. - Convert memmove() function calls to charmove() macro calls, as the former all work on char*'s. (DLR) - files.c: diff --git a/src/winio.c b/src/winio.c index 31c18727..1f9664d3 100644 --- a/src/winio.c +++ b/src/winio.c @@ -367,23 +367,25 @@ size_t actual_x(const char *str, size_t xplus) return i; } -/* A strlen with tabs factored in, similar to xplustabs(). */ +/* A strlen with tabs factored in, similar to xplustabs(). How many + * columns wide are the first size characters of buf? */ size_t strnlenpt(const char *buf, size_t size) { size_t length = 0; - if (buf != NULL) - for (; *buf != '\0' && size != 0; size--, buf++) { - if (*buf == '\t') - length += tabsize - (length % tabsize); - else if (is_cntrl_char((int)*buf)) - length += 2; - else - length++; - } + assert(buf != NULL); + for (; *buf != '\0' && size != 0; size--, buf++) { + if (*buf == '\t') + length += tabsize - (length % tabsize); + else if (is_cntrl_char((int)*buf)) + length += 2; + else + length++; + } return length; } +/* How many columns wide is buf? */ size_t strlenpt(const char *buf) { return strnlenpt(buf, -1); @@ -391,7 +393,7 @@ size_t strlenpt(const char *buf) void blank_bottombars(void) { - if (!no_help()) { + if (!ISSET(NO_HELP)) { mvwaddstr(bottomwin, 1, 0, hblank); mvwaddstr(bottomwin, 2, 0, hblank); }