From 9e438cdce16ed63ac10cec3a97b20950707d9d73 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 16 Aug 2015 12:15:11 +0000 Subject: [PATCH] Determining the length of the current line by starting at the very beginning of it instead of at the wrap location. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5362 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/help.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 583f487e..19875997 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ * src/help.c: Adjust some comments and whitespace. * src/help.c (do_help, do_help_void): Don't bother passing a function when it's used only once. + * src/help.c (help_line_len): The wrap location can be beyond the EOL, + so for determining the length of the current line, don't start at that + location but at the beginning. This fixes Savannah bug #45770. 2015-08-13 Benno Schulenberg * src/search.c (do_find_bracket): Remove mistaken comparison between diff --git a/src/help.c b/src/help.c index e9f0e272..fa63f06b 100644 --- a/src/help.c +++ b/src/help.c @@ -512,6 +512,8 @@ size_t help_line_len(const char *ptr) size_t retval = (wrap_loc < 0) ? 0 : wrap_loc; size_t retval_save = retval; + retval = 0; + /* Get the length of the entire line up to a null or a newline. */ while (*(ptr + retval) != '\0' && *(ptr + retval) != '\n') retval += move_mbright(ptr + retval, 0); -- 2.39.5