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:
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);
void blank_bottombars(void)
{
- if (!no_help()) {
+ if (!ISSET(NO_HELP)) {
mvwaddstr(bottomwin, 1, 0, hblank);
mvwaddstr(bottomwin, 2, 0, hblank);
}